:root {
  --social-ink: #1d2b25;
  --social-muted: #64736b;
  --social-green: #1e6851;
  --social-rail: #153c32;
  --social-canvas: #f6f8f5;
  --social-line: #e3e9e4;
}

body.social-mode .application { grid-template-columns: minmax(0, 1fr) !important; }
body.social-mode .rail,
body.social-mode .sidebar,
body.social-mode .topbar { display: none !important; }
body.social-mode .app-workspace,
body.social-mode .main-content { min-width: 0; height: 100vh; }
body.social-mode .main-content { padding: 0 !important; overflow: hidden !important; background: var(--social-canvas); }

.social-app {
  display: grid;
}
.social-app button, .social-app input, .social-app textarea, .social-app select { font: inherit; }
.social-app button { cursor: pointer; }
.social-app button:focus-visible, .social-app input:focus-visible, .social-app textarea:focus-visible, .social-app select:focus-visible {
  outline: 2px solid #4c9379;
  outline-offset: 2px;
}

.social-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
}
.social-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}
.social-brand > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 13px 13px 13px 5px;
  color: var(--social-rail);
  background: #d9eadc;
  font-size: 18px;
  font-weight: 700;
}
.social-rail-button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 2px;
  border: 0;
  background: transparent;
}
.social-rail-button span { white-space: nowrap; }
.social-rail-spacer { flex: 1; }
.social-rail-badge-wrap { position: relative; width: 100%; }
.social-rail-badge-wrap .social-rail-button { margin: auto; }
.social-rail-badge {
  position: absolute;
  top: 0;
  right: 3px;
  min-width: 16px;
  padding: 1px 4px;
  border-radius: 10px;
  color: #fff;
  font-size: 12px;
  text-align: center;
}
.social-me {
  display: grid;
  place-items: center;
  margin-top: 6px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
}

.social-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--social-line);
}
.social-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
}
.social-list-head h2 { margin: 0; letter-spacing: -.02em; }
.social-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
}
.social-search {
  display: flex;
  align-items: center;
  flex: none;
  border: 1px solid transparent;
  color: var(--social-muted);
}
.social-search input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; color: var(--social-ink); background: transparent; }
.social-search input::placeholder { opacity: 1; }
.social-room-list, .social-contact-scroll { min-height: 0; overflow-y: auto; }
.social-room-list { flex: 1; }
.social-room {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  color: var(--social-ink);
  background: transparent;
  text-align: left;
}
.social-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 14px;
}
.social-avatar.small { font-size: 12px; }
.social-room-copy { flex: 1; min-width: 0; }
.social-room-title { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.social-room-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social-room-title time { flex: none; }
.social-room-preview { display: block; overflow: hidden; color: var(--social-muted); text-overflow: ellipsis; white-space: nowrap; }
.social-unread {
  align-self: flex-end;
  min-width: 18px;
  margin-bottom: 4px;
  padding: 2px 5px;
  border-radius: 10px;
  color: #fff;
  font-size: 12px;
  text-align: center;
}
.social-list-empty { padding: 46px 22px; color: var(--social-muted); text-align: center; }
.social-list-empty p { margin: 0 0 16px; font-size: 12px; line-height: 1.7; }
.social-contact-scroll { flex: 1; }
.social-sidebar-note { margin: 0 3px 16px; line-height: 1.65; }
.social-requests h3, .social-contacts h3 { margin: 10px 3px 9px; color: var(--social-muted); font-size: 12px; font-weight: 500; }
.social-request, .social-contact {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 3px;
  border-bottom: 1px solid #edf0ed;
}
.social-request > div:not(.social-request-actions), .social-contact > div { flex: 1; min-width: 0; }
.social-request strong, .social-contact strong { display: block; overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.social-request small, .social-contact small { display: block; margin-top: 3px; overflow: hidden; color: var(--social-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.social-request { flex-wrap: wrap; }
.social-request-actions { display: flex; gap: 5px; width: 100%; padding-left: 50px; }
.social-ai-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
}
.social-ai-copy { min-width: 0; }
.social-ai-copy strong, .social-ai-copy small, .social-ai-copy span { display: block; }
.social-ai-copy strong { font-size: 13px; }
.social-ai-copy small { margin-top: 3px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.social-ai-copy span { margin-top: 7px; color: var(--social-muted); font-size: 12px; line-height: 1.5; }
.social-ai-actions { display: flex; align-items: center; justify-content: space-between; grid-column: 1 / -1; }
.social-text-button { padding: 2px; border: 0; background: transparent; font-size: 12px; }
.social-muted { font-size: 12px; line-height: 1.65; }

.social-main { position: relative; display: flex; min-width: 0; min-height: 0; }
.social-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
}
.social-chat-head h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social-chat-head p { margin: 4px 0 0; }
.social-back { display: none; margin-right: 5px; font-size: 28px; line-height: 1; }
.social-chat-actions { display: flex; align-items: center; }
.social-chat-actions .social-group-files-shortcut { display: none; }
@media (min-width: 1060px) {
  .social-chat-actions .social-group-files-shortcut { display: grid; place-items: center; }
  .social-apps-popover [data-social-group-files-menu-item] { display: none; }
}
.social-message-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.social-message-list { margin: 0 auto; }
.social-message { display: flex; align-items: flex-start; }
.social-topics .social-group-pane-title h2 { margin: 0; font: inherit; color: var(--wb-ink); }
.social-topic-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.social-topic-list .social-topic-chip { width: 100%; color: var(--wb-ink); }
.social-topic-list .social-topic-chip[aria-current="true"] { background: var(--wb-accent-soft); color: var(--wb-ink); }
.social-topic-list .social-topic-chip > b { margin-inline-start: auto; font-size: 11px; }
.social-topic-create, .social-topic-back {
  min-height: 28px;
  min-width: 28px;
  padding: 0 6px;
  border: 1px solid var(--wb-line);
  border-radius: 6px;
  background: var(--wb-surface);
  color: var(--wb-ink);
  cursor: pointer;
}
.social-topic-create { display: grid; place-items: center; }
.social-topics .social-topic-back { margin-bottom: 6px; }
.social-topic-load-error p { margin: 0 0 6px; color: var(--wb-ink); font-size: .75rem; }
.social-topics .social-group-pane-empty { color: var(--wb-ink); }
.social-topic-actions { display: flex; flex-wrap: wrap; gap: 4px; }
:is(.social-topic-create, .social-topic-back, .social-topic-parent, .social-topic-chip):focus-visible {
  outline: 2px solid var(--wb-accent);
  outline-offset: 2px;
}
.social-topic-members { margin: 0; padding: 9px; border: 1px solid var(--wb-line); border-radius: 8px; }
.social-topic-member { display: flex; align-items: center; gap: 8px; min-height: 30px; color: var(--wb-ink); }
.social-topic-member input[type="checkbox"] { flex: none; width: 18px; min-height: 18px; accent-color: var(--wb-accent); }
@media (min-width: 1024px) {
  .social-chat.is-topic .social-group-pane { position: relative; inset: auto; box-shadow: none; }
}
.social-message.mine { justify-content: flex-end; }
.social-message-main { min-width: 0; }
.social-message.mine .social-message-main { display: flex; flex-direction: column; align-items: flex-end; }
.social-message-author { display: flex; align-items: center; gap: 6px; margin: 0 0 5px 3px; }
.social-bubble {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.social-message.mine .social-bubble { border-color: #cfe2d3; }
.social-message-meta { display: flex; flex-wrap: wrap; }
.social-run-states { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.social-no-messages { padding: 80px 20px; text-align: center; }
.social-composer-area { flex: none; margin: 0 auto; }
.social-composer {
  display: flex;
  align-items: flex-end;
  border: 1px solid #dbe4dc;
}
.social-composer textarea { flex: 1; min-width: 0; max-height: 140px; padding: 4px 0; border: 0; outline: 0; resize: none; color: var(--social-ink); background: transparent; }
.social-composer textarea::placeholder { opacity: 1; }
.social-send { display: grid; place-items: center; flex: none; border: 0; }
.social-send:disabled { cursor: wait; }
.social-empty-chat { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.social-empty-symbol { display: grid; place-items: center; color: #46745d; }
.social-empty-chat h1 { margin: 0 0 10px; }
.social-empty-chat p { margin: 0; }

.social-details { position: absolute; z-index: 5; top: 0; right: 0; bottom: 0; overflow-y: auto; border-left: 1px solid var(--social-line); }
.social-details-head { display: flex; align-items: center; justify-content: space-between; }
.social-details-head h3 { margin: 0; font-size: 14px; }
.social-member { display: flex; border-bottom: 1px solid #edf0ed; }
.social-member strong, .social-member small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social-member small { margin-top: 3px; }
.social-member > .social-member-menu-wrap { position: relative; flex: none; margin-left: auto; }

.social-modal-backdrop { position: fixed; z-index: 100; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; }
.social-modal { overflow-y: auto; }
.social-modal > header { display: flex; align-items: center; justify-content: space-between; }
.social-modal > header h2 { margin: 0; }
.social-form { display: grid; }
.social-form .field { margin: 0; }
.social-group-file-filter { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.social-group-file-filter input { min-width: 0; }
.social-group-file-list { display: grid; max-height: 44vh; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.social-group-file-list li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--wb-line); }
.social-group-file-list strong { min-width: 0; overflow-wrap: anywhere; font-size: 0.875rem; }
.social-group-file-actions { display: flex; flex: none; flex-wrap: wrap; gap: 4px; }
.social-group-file-actions :is(a, button) { white-space: nowrap; }
.social-file-access-trigger.button { display: block; max-width: 100%; margin-top: 4px; padding-inline: 4px; font-size: 12px; }
.social-form .social-file-access-choice { display: flex; align-items: center; gap: 8px; }
.social-file-access-choice input { margin: 0; }
.social-file-access-members { display: grid; gap: 8px; max-height: 30vh; overflow: auto; border: 1px solid var(--wb-line); border-radius: 8px; padding: 12px; }
.social-form-grid { display: grid; grid-template-columns: 1fr 110px; gap: 12px; }
.social-form fieldset { display: grid; margin: 0; border: 1px solid var(--social-line); }
.social-form legend { padding: 0 5px; }
.social-choice { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.social-choice input { width: 15px; height: 15px; accent-color: var(--social-green); }
.social-choice span { font-size: 12px; }
.social-choice small { margin-left: auto; }
.social-form .social-agent-checklist { gap: 8px; padding: 4px 0 0; border: 0; }
.social-agent-checklist legend { padding: 0; color: inherit; font-size: 13px; font-weight: 600; }
.social-agent-choices { display: grid; gap: 4px; max-height: min(40vh, 312px); overflow: auto; }
.social-agent-choices > :is(label, p)[hidden] { display: none; }
.social-agent-choice {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
}
.social-agent-choice:hover { background: var(--surface-muted, #f3f5f6); }
.social-agent-choice:has(input:checked) { border-color: var(--social-line); background: var(--surface-muted, #f3f5f6); }
.social-agent-choice-copy { display: grid; gap: 3px; min-width: 0; }
.social-agent-choice-copy strong { font-size: 13px; font-weight: 600; }
.social-agent-choice .social-agent-choice-copy small { margin-inline-start: 0; font-size: 12px; }
.social-agent-choice-copy > *, .social-agent-choice-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.social-agent-choice-role { max-width: 10ch; }
.social-invite-people { padding: 10px 0; border-top: 1px solid var(--social-line); }
.social-invite-people > summary { font-size: 13px; font-weight: 600; cursor: pointer; }
.social-invite-people[open] > summary { margin-bottom: 6px; }
.social-modal-actions { display: flex; justify-content: flex-end; }
.social-budget-entry { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; padding: 12px 0; border-block: 1px solid var(--social-line); }
.social-budget-entry strong, .social-budget-entry small { display: block; }
.social-budget-entry strong { color: var(--social-ink); font-size: 12px; }
.social-budget-entry small { margin-top: 6px; color: var(--social-muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.social-budget-entry .social-text-button { flex: none; min-height: 44px; }
.social-budget-total { margin: 16px 0; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; }
.social-budget-error { margin: 0; color: #7a392f; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.social-cancel-run { min-height: 44px; margin-left: 8px; padding: 4px 8px; border: 0; background: transparent; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.social-cancel-run:disabled { opacity: .6; cursor: wait; }
.social-cancel-run:focus-visible, .social-budget-entry button:focus-visible { outline: 2px solid #28624d; outline-offset: 3px; }
.social-run.cancelled { color: var(--social-muted); }
.social-reconciliation-intro { margin: 0; color: var(--social-ink); font-size: 14px; line-height: 1.8; }
.social-reconciliation-facts { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px 14px; margin: 0; padding-block: 14px; border-block: 1px solid var(--social-line); font-size: 14px; line-height: 1.7; }
.social-reconciliation-facts dd { min-width: 0; margin: 0; color: var(--social-ink); overflow-wrap: anywhere; }
.social-reconciliation-status { margin: 0; font-size: 14px; line-height: 1.8; }
.social-reconciliation textarea, .social-reconciliation input:not([type="checkbox"]) { min-width: 0; width: 100%; font-size: 16px; }
.social-reconciliation-consent { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.7; cursor: pointer; }
.social-reconciliation-consent input { flex: none; width: 18px; height: 18px; margin-top: 3px; accent-color: var(--social-green); }
.social-reconciliation-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.social-reconciliation-actions button { min-height: 44px; }
.social-reconciliation-history { padding-top: 8px; border-top: 1px solid var(--social-line); }
.social-reconciliation-history h3 { margin: 0 0 10px; font-size: 15px; }
.social-reconciliation-history article { padding-block: 12px; border-bottom: 1px solid var(--social-line); }
.social-reconciliation-history p { margin: 0 0 5px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.social-reconciliation-history small { font-size: 12px; overflow-wrap: anywhere; }

@media (max-width: 980px) {
  .social-app { grid-template-columns: 64px 250px minmax(0, 1fr); }
  .social-message-list, .social-composer-area { padding-left: 20px; padding-right: 20px; }
  .social-message-main { max-width: 84%; }
}

@media (max-width: 700px) {
  .social-rail { flex-direction: row; justify-content: space-around; }
  .social-brand, .social-rail-spacer, .social-me { display: none; }
  .social-rail-badge-wrap { width: auto; }
  .social-rail-badge { right: 0; }
  .social-app.has-room .social-sidebar { display: none; }
  .social-app:not(.has-room) .social-main { display: none; }
  .social-chat-head p { display: none; }
  .social-back { display: inline-flex; }
  .social-chat-actions .button { display: none; }
  .social-form-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .social-rail-button, .social-send { transition: none !important; }
}
