:root {
  --page: #f3efe7;
  --surface: rgba(255, 250, 242, 0.9);
  --surface-strong: #fffaf2;
  --text: #1f2d2a;
  --muted: #61706c;
  --line: rgba(45, 74, 66, 0.14);
  --accent: #1d6b58;
  --accent-strong: #144e41;
  --accent-soft: rgba(29, 107, 88, 0.1);
  --user: #173e63;
  --error: #ab4d3f;
  --sidebar-width: clamp(17.5rem, 18vw, 20.5rem);
  --chat-column-width: clamp(48rem, 44vw, 58rem);
  --topbar-height: 4.25rem;
  --radius-lg: 1.4rem;
  --radius-md: 1rem;
  --shadow: 0 18px 40px rgba(34, 48, 44, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: #f8f3eb;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

body.app-shell {
  overflow-x: hidden;
}

body.app-shell.sidebar-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

code {
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(28, 43, 40, 0.08);
  font-size: 0.9em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  position: relative;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.54), transparent 32%),
    linear-gradient(180deg, rgba(255, 251, 244, 0.82), rgba(244, 238, 228, 0.72));
}

.app-layout[data-sidebar-state="closed"] {
  grid-template-columns: 0 minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(250, 244, 235, 0.84);
  backdrop-filter: blur(18px);
  overflow-x: hidden;
  overflow-y: hidden;
  transition: transform 180ms ease, opacity 180ms ease, visibility 180ms ease;
  z-index: 30;
}

.app-layout[data-sidebar-state="closed"] .app-sidebar {
  transform: translateX(-1rem);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-sidebar-backdrop {
  display: none;
}

.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 0.8rem 6.5rem;
  overflow-y: auto;
}

.sidebar-sticky-top {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-top: 0.85rem;
  padding-bottom: 0.9rem;
  background:
    linear-gradient(180deg, rgba(248, 243, 235, 0.98) 0%, rgba(248, 243, 235, 0.92) 78%, rgba(248, 243, 235, 0) 100%);
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.sidebar-brand {
  min-width: 0;
}

.sidebar-brand-mark,
.chat-topbar-mark,
.sidebar-section-kicker,
.empty-state-kicker {
  margin: 0 0 0.18rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-brand-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.sidebar-primary-actions {
  display: grid;
  gap: 0.65rem;
}

.sidebar-primary-actions .button_to,
.empty-state .button_to {
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.85rem;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.button-primary {
  color: #f7fbfa;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.button-primary:disabled {
  color: var(--muted);
  background: rgba(28, 43, 40, 0.08);
}

.sidebar-primary-button {
  width: 100%;
}

.sidebar-search-field {
  display: block;
}

.sidebar-search-input {
  width: 100%;
  min-height: 2.7rem;
  padding: 0 0.95rem;
  border: 1px solid rgba(45, 74, 66, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
}

.sidebar-search-input::placeholder,
.conversation-menu-preview,
.empty-state-copy,
.message-speaker,
.flash {
  color: var(--muted);
}

.sidebar-search-input:focus,
.icon-button:focus-visible,
.conversation-menu-button:focus-visible,
.conversation-menu-link:focus-visible,
.sidebar-link:focus-visible,
.conversation-row-link:focus-visible {
  outline: 2px solid rgba(29, 107, 88, 0.18);
  outline-offset: 2px;
}

.composer-input:focus {
  outline: none;
  box-shadow: none;
}

.sidebar-fixed-links {
  display: grid;
  gap: 0.3rem;
  padding: 0.2rem 0 0.9rem;
  border-bottom: 1px solid rgba(45, 74, 66, 0.08);
}

.sidebar-link {
  display: flex;
  align-items: center;
  min-height: 2.45rem;
  padding: 0 0.75rem;
  border-radius: 0.85rem;
  color: var(--muted);
  transition: background 140ms ease, color 140ms ease;
}

.sidebar-link:hover,
.sidebar-link.is-current {
  color: var(--text);
  background: rgba(255, 255, 255, 0.54);
}

.sidebar-section {
  padding-top: 1rem;
}

.sidebar-account {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 0.9rem 0.75rem 1rem;
  border-top: 1px solid rgba(45, 74, 66, 0.08);
  background: rgba(248, 243, 235, 0.94);
  backdrop-filter: blur(18px);
}

.sidebar-account-details {
  min-width: 0;
}

.sidebar-account-name,
.sidebar-account-meta,
.sidebar-build-version {
  margin: 0;
}

.sidebar-account-name {
  font-weight: 600;
}

.sidebar-account-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.sidebar-build-version {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  margin-top: 0.4rem;
  color: var(--muted);
}

.sidebar-build-version-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-build-version-value {
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Consolas, monospace;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.sidebar-signout-button {
  min-height: 2.35rem;
  padding-inline: 0.9rem;
}

.settings-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.9rem;
  color: var(--text);
}

.sidebar-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.sidebar-section-header h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-section-header span {
  color: var(--muted);
  font-size: 0.82rem;
}

.sidebar-empty {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.conversation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.conversation-row {
  position: relative;
  min-width: 0;
}

.conversation-row[hidden] {
  display: none;
}

.conversation-row-shell {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.15rem;
  min-width: 0;
  min-height: 2.45rem;
  padding: 0 0.3rem 0 0.2rem;
  border-radius: 0.85rem;
  transition: background 140ms ease;
}

.conversation-row:hover .conversation-row-shell,
.conversation-row:focus-within .conversation-row-shell,
.conversation-row.is-current .conversation-row-shell,
.conversation-row.is-menu-open .conversation-row-shell {
  background: rgba(255, 255, 255, 0.6);
}

.conversation-row-link {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  min-height: 2.45rem;
  padding: 0 0.55rem;
  border-radius: 0.7rem;
  transition: color 140ms ease;
}

.conversation-row.is-current .conversation-row-link {
  color: var(--text);
}

.conversation-row-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.95rem;
}

.conversation-menu {
  position: relative;
}

.conversation-menu summary {
  list-style: none;
}

.conversation-menu summary::-webkit-details-marker {
  display: none;
}

.conversation-menu-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, opacity 140ms ease;
}

.conversation-menu-button {
  opacity: 0;
  pointer-events: none;
}

.icon-button {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid rgba(45, 74, 66, 0.12);
  background: rgba(255, 255, 255, 0.45);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(34, 48, 44, 0.06);
  opacity: 1;
  pointer-events: auto;
}

.conversation-row:hover .conversation-menu-button,
.conversation-row:focus-within .conversation-menu-button,
.conversation-row.is-menu-open .conversation-menu-button {
  opacity: 1;
  pointer-events: auto;
}

.conversation-menu-dots,
.conversation-menu-dots::before,
.conversation-menu-dots::after {
  width: 0.22rem;
  height: 0.22rem;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.conversation-menu-dots {
  position: relative;
  display: block;
}

.conversation-menu-dots::before,
.conversation-menu-dots::after {
  position: absolute;
  top: 0;
}

.conversation-menu-dots::before {
  left: -0.38rem;
}

.conversation-menu-dots::after {
  left: 0.38rem;
}

.conversation-menu-button:hover,
.conversation-menu-button:focus-visible,
.icon-button:hover,
.conversation-row.is-menu-open .conversation-menu-button,
.conversation-row:focus-within .conversation-menu-button {
  background: rgba(255, 255, 255, 0.56);
  color: var(--text);
}

.conversation-menu-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 10;
  width: 12rem;
  padding: 0.45rem;
  border: 1px solid rgba(45, 74, 66, 0.14);
  border-radius: 1rem;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.conversation-menu-panel[hidden],
.conversation-rename-form[hidden] {
  display: none;
}

.conversation-menu-form {
  margin: 0;
}

.conversation-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 2.4rem;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: 0.8rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.conversation-menu-item:hover,
.conversation-menu-item:focus-visible {
  background: rgba(255, 255, 255, 0.7);
  outline: none;
}

.conversation-menu-item.is-danger {
  color: var(--error);
}

.conversation-rename-form {
  display: grid;
  gap: 0.6rem;
  padding: 0.65rem;
  border: 1px solid rgba(45, 74, 66, 0.14);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.72);
}

.conversation-rename-input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 0.8rem;
  border: 1px solid rgba(45, 74, 66, 0.16);
  border-radius: 0.85rem;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.conversation-rename-input:focus {
  outline: 2px solid rgba(29, 107, 88, 0.18);
  outline-offset: 2px;
}

.conversation-rename-actions {
  display: flex;
  gap: 0.45rem;
}

.conversation-rename-submit,
.conversation-rename-cancel {
  flex: 1;
  min-height: 2.2rem;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.conversation-rename-submit {
  color: #f7fbfa;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.conversation-rename-cancel {
  color: var(--text);
  background: rgba(28, 43, 40, 0.08);
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: currentColor;
}

.conversation-menu-preview {
  margin: 0.55rem 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.conversation-menu-link {
  display: inline-flex;
  align-items: center;
  margin-top: 0.75rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
}

.button-secondary {
  color: var(--text);
  background: rgba(28, 43, 40, 0.08);
}

.button-danger {
  color: #fff4f2;
  background: linear-gradient(135deg, #b65242, #8e3124);
}

.settings-shell {
  width: min(100%, 46rem);
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.settings-shell h2 {
  margin: 0.35rem 0 0;
  font-size: clamp(1.8rem, 2.6vw, 2.4rem);
}

.settings-section + .settings-section {
  margin-top: 2.4rem;
  padding-top: 2.4rem;
  border-top: 1px solid rgba(45, 74, 66, 0.08);
}

.settings-copy {
  margin: 0.75rem 0 1.4rem;
  color: var(--muted);
  line-height: 1.6;
}

.settings-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.settings-section + .linked-user-disclosure,
.linked-user-disclosure + .linked-user-disclosure {
  margin-top: 1.35rem;
}

.linked-user-disclosure {
  border: 1px solid rgba(45, 74, 66, 0.1);
  border-radius: 1.35rem;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0.8rem 1.75rem rgba(34, 48, 44, 0.05);
  overflow: clip;
}

.linked-user-disclosure-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.4rem;
  cursor: pointer;
  list-style: none;
}

.linked-user-disclosure-summary::-webkit-details-marker {
  display: none;
}

.linked-user-disclosure-summary:focus-visible {
  outline: 2px solid rgba(29, 107, 88, 0.18);
  outline-offset: -2px;
}

.linked-user-disclosure-copy {
  min-width: 0;
}

.linked-user-disclosure-summary h2 {
  margin: 0.35rem 0 0;
  font-size: clamp(1.35rem, 2vw, 1.7rem);
}

.linked-user-disclosure-description {
  margin: 0.7rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.linked-user-disclosure-indicator {
  width: 0.8rem;
  height: 0.8rem;
  flex: 0 0 auto;
  margin-top: 0.8rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  color: var(--muted);
  transform: rotate(45deg);
  transition: transform 140ms ease, color 140ms ease;
}

.linked-user-disclosure[open] .linked-user-disclosure-summary {
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(45, 74, 66, 0.08);
}

.linked-user-disclosure[open] .linked-user-disclosure-indicator {
  color: var(--text);
  transform: rotate(225deg);
}

.linked-user-disclosure-panel {
  display: grid;
  gap: 1.4rem;
  padding: 0 1.4rem 1.4rem;
}

.linked-user-subsection + .linked-user-subsection {
  padding-top: 1.4rem;
  border-top: 1px solid rgba(45, 74, 66, 0.08);
}

.linked-user-subsection h3 {
  margin: 0;
  font-size: 1.08rem;
}

.settings-toolbar-button {
  min-height: 2.45rem;
  padding: 0.55rem 1rem;
}

.settings-section-harness {
  --settings-harness-action-width: clamp(6.1rem, 11vw, 6.75rem);
}

.settings-section-harness .settings-section-header {
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 0.95rem;
}

.settings-section-harness .settings-section-header > div {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-section-harness .settings-harness-action-button {
  min-width: var(--settings-harness-action-width);
  width: 100%;
  white-space: nowrap;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    filter 140ms ease;
  box-shadow: 0 0.7rem 1.5rem rgba(31, 52, 47, 0.08);
}

.settings-section-harness .settings-harness-action-button:hover,
.settings-section-harness .settings-harness-action-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 0.95rem 1.85rem rgba(31, 52, 47, 0.12);
  filter: saturate(1.03);
}

.settings-section-harness .settings-toolbar-button {
  flex: 0 0 var(--settings-harness-action-width);
  align-self: flex-start;
}

.settings-chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.settings-chat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(45, 74, 66, 0.1);
  border-radius: 1.15rem;
  background: rgba(255, 255, 255, 0.55);
}

.settings-section-harness .settings-chat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--settings-harness-action-width);
  align-items: flex-start;
  gap: 1rem 1.25rem;
}

.settings-chat-copy {
  min-width: 0;
}

.settings-section-harness .settings-chat-copy {
  padding-top: 0.15rem;
}

.settings-chat-link {
  display: inline-flex;
  max-width: 100%;
  font-weight: 700;
}

.settings-chat-meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.settings-document-snippet {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.settings-chat-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-section-harness .settings-chat-actions {
  display: grid;
  gap: 0.65rem;
  justify-items: stretch;
}

.settings-chat-actions .button_to {
  margin: 0;
}

.settings-section-harness .settings-chat-actions .button_to {
  display: block;
}

.settings-chat-button {
  min-height: 2.45rem;
  padding: 0.55rem 0.95rem;
}

.settings-form {
  display: grid;
  gap: 1.2rem;
}

.settings-form-grid {
  display: grid;
  gap: 1rem;
}

.settings-form-field {
  display: grid;
  gap: 0.45rem;
}

.settings-form-field label {
  font-weight: 700;
}

.settings-editor-note {
  padding: 0.95rem 1rem;
  border: 1px solid rgba(45, 74, 66, 0.1);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
  line-height: 1.55;
}

.settings-form-input,
.settings-form-textarea,
trix-editor.settings-rich-textarea,
trix-toolbar .trix-input--dialog {
  width: 100%;
  border: 1px solid rgba(45, 74, 66, 0.14);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.settings-form-input,
.settings-form-textarea,
trix-toolbar .trix-input--dialog {
  padding: 0.85rem 1rem;
}

.settings-form-input:focus,
.settings-form-textarea:focus,
trix-editor.settings-rich-textarea:focus-within,
trix-toolbar .trix-input--dialog:focus {
  outline: 2px solid rgba(29, 107, 88, 0.18);
  outline-offset: 2px;
}

.settings-form-textarea {
  min-height: 22rem;
  resize: vertical;
  font-family: "SFMono-Regular", "SF Mono", "Consolas", monospace;
  line-height: 1.55;
}

trix-toolbar {
  margin-bottom: 0.6rem;
}

trix-toolbar .trix-button-group {
  border-radius: 999px;
  border-color: rgba(45, 74, 66, 0.12);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

trix-toolbar .trix-button {
  min-height: 2rem;
}

trix-toolbar .trix-button-group--file-tools {
  display: none;
}

trix-toolbar .trix-dialog {
  border-top: 0;
  border-radius: 1rem;
  box-shadow: 0 18px 40px rgba(34, 48, 44, 0.12);
}

trix-editor.settings-rich-textarea {
  min-height: 18rem;
  padding: 1rem 1.05rem;
  border-radius: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

trix-editor.settings-rich-textarea h1 {
  font-size: 1.35rem;
}

.settings-editor-actions {
  align-items: center;
}

.settings-check-row {
  align-items: stretch;
}

.settings-check-label {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  width: 100%;
  cursor: pointer;
}

.settings-check-label input[type="checkbox"] {
  margin-top: 0.2rem;
}

.settings-document-preview {
  padding: 1rem 1.05rem;
  border: 1px solid rgba(45, 74, 66, 0.1);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.58);
  overflow-x: auto;
}

.settings-document-preview pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.6;
}

.linked-user-change-set-stack {
  display: grid;
  gap: 1rem;
}

.settings-transcript,
.settings-brief-stack {
  display: grid;
  gap: 1rem;
}

.settings-transcript-entry,
.settings-brief-card {
  padding: 1rem 1.05rem;
  border: 1px solid rgba(45, 74, 66, 0.1);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.58);
}

.settings-transcript-speaker,
.settings-brief-card h3 {
  margin: 0 0 0.55rem;
  font-weight: 700;
}

.settings-transcript-entry pre,
.settings-brief-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

.settings-brief-body p {
  margin: 0;
}

.settings-brief-body p + p {
  margin-top: 0.75rem;
}

.chat-panel {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.chat-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--topbar-height);
  padding: 0.85rem 1.35rem;
  border-bottom: 1px solid rgba(45, 74, 66, 0.08);
  background:
    linear-gradient(180deg, rgba(248, 243, 235, 0.96) 0%, rgba(248, 243, 235, 0.9) 82%, rgba(248, 243, 235, 0.72) 100%);
  backdrop-filter: blur(18px);
}

.chat-topbar-start {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.chat-topbar-copy {
  min-width: 0;
}

.chat-topbar-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.topbar-action-form {
  margin: 0;
}

.topbar-tooltip-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.topbar-action-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.1rem;
  padding: 0.48rem 0.85rem;
  border: 1px solid rgba(24, 88, 73, 0.16);
  border-radius: 999px;
  background: rgba(24, 88, 73, 0.08);
  color: rgba(24, 88, 73, 0.9);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
}

.topbar-action-chip:hover:not(:disabled),
.topbar-action-chip:focus-visible:not(:disabled) {
  background: rgba(24, 88, 73, 0.13);
  color: rgba(24, 88, 73, 0.98);
}

.topbar-action-chip:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.topbar-tooltip {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  z-index: 12;
  width: min(20rem, calc(100vw - 2rem));
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(27, 35, 34, 0.12);
  border-radius: 0.85rem;
  background: rgba(18, 21, 20, 0.96);
  color: rgba(248, 244, 237, 0.96);
  font-size: 0.78rem;
  line-height: 1.4;
  box-shadow: 0 14px 28px rgba(21, 23, 22, 0.2);
}

.topbar-tooltip::before {
  content: "";
  position: absolute;
  top: -0.38rem;
  right: 1.1rem;
  width: 0.72rem;
  height: 0.72rem;
  border-top: 1px solid rgba(27, 35, 34, 0.12);
  border-left: 1px solid rgba(27, 35, 34, 0.12);
  background: rgba(18, 21, 20, 0.96);
  transform: rotate(45deg);
}

.chat-topbar h1 {
  margin: 0;
  font-size: clamp(1rem, 1.1vw, 1.15rem);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-topbar-mark {
  margin-bottom: 0.1rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.8rem;
  border-radius: 999px;
  background: rgba(28, 43, 40, 0.06);
  font-size: 0.78rem;
  font-weight: 700;
}

.context-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(40, 88, 77, 0.14);
  background: rgba(40, 88, 77, 0.08);
  color: rgba(28, 43, 40, 0.82);
  font-size: 0.78rem;
  font-weight: 700;
}

.skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(130, 94, 23, 0.14);
  background: rgba(176, 136, 42, 0.1);
  color: rgba(92, 68, 16, 0.9);
  font-size: 0.78rem;
  font-weight: 700;
}

.skill-chip:focus-visible {
  outline: 2px solid rgba(130, 94, 23, 0.35);
  outline-offset: 2px;
}

.status-chip-streaming {
  color: var(--accent);
  background: var(--accent-soft);
}

.status-chip-error {
  color: var(--error);
  background: rgba(171, 77, 63, 0.1);
}

.context-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(40, 88, 77, 0.7);
  box-shadow: 0 0 0 0.2rem rgba(40, 88, 77, 0.12);
}

.skill-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(130, 94, 23, 0.8);
  box-shadow: 0 0 0 0.2rem rgba(176, 136, 42, 0.14);
}

.icon-bars,
.icon-bars::before,
.icon-bars::after {
  display: block;
  width: 1rem;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.icon-bars {
  position: relative;
}

.icon-bars::before {
  position: absolute;
  top: -0.3rem;
  left: 0;
}

.icon-bars::after {
  position: absolute;
  top: 0.3rem;
  left: 0;
}

.chat-column {
  width: min(100%, var(--chat-column-width));
  margin: 0 auto;
  padding: 0 1.5rem;
  flex: 1;
  min-height: calc(100dvh - var(--topbar-height));
  display: flex;
  flex-direction: column;
}

.messages-shell {
  flex: 1 0 auto;
  overflow: visible;
  overflow-anchor: none;
}

.messages-canvas {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.35rem 0 1rem;
  align-items: stretch;
}

.messages-tail {
  width: 100%;
  height: 0;
  pointer-events: none;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-width: 100%;
  position: relative;
}

.message-assistant,
.message-system {
  align-self: flex-start;
}

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

.message-user-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-bottom: 2.35rem;
  margin-bottom: -2.35rem;
}

.message-tools {
  position: absolute;
  bottom: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0.28rem;
  border: 1px solid rgba(45, 74, 66, 0.12);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: 0 10px 20px rgba(34, 48, 44, 0.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-0.12rem);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
  z-index: 2;
}

.message-user-shell:hover .message-tools,
.message-user-shell:focus-within .message-tools {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.message-speaker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.message-card {
  max-width: min(100%, 42rem);
  padding: 0.95rem 1rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(45, 74, 66, 0.08);
  line-height: 1.6;
}

.message-assistant .message-card {
  padding-left: 0;
  padding-right: 0;
  background: transparent;
  border: 0;
}

.message-user .message-card {
  color: #eef5fb;
  background: linear-gradient(135deg, var(--user), #285a88);
  border: 0;
}

.message-system .message-card {
  border-style: dashed;
}

.message-card-error {
  border-color: rgba(171, 77, 63, 0.22);
  background: rgba(171, 77, 63, 0.08);
}

.message-card p {
  margin: 0;
}

.message-card p + p {
  margin-top: 0.85rem;
}

.message-markdown {
  overflow-wrap: anywhere;
}

.message-markdown > :first-child,
.message-markdown > * > :first-child {
  margin-top: 0;
}

.message-markdown > :last-child,
.message-markdown > * > :last-child {
  margin-bottom: 0;
}

.message-markdown ul,
.message-markdown ol {
  margin: 0.75rem 0 0.75rem 1.35rem;
  padding: 0;
}

.message-markdown li + li {
  margin-top: 0.3rem;
}

.message-markdown blockquote {
  margin: 0.9rem 0;
  padding-left: 0.9rem;
  border-left: 3px solid rgba(29, 107, 88, 0.2);
  color: var(--muted);
}

.message-markdown pre {
  margin: 0.9rem 0;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  border: 1px solid rgba(45, 74, 66, 0.08);
  border-radius: 1rem;
  background: rgba(28, 43, 40, 0.06);
}

.message-markdown code {
  padding: 0.12rem 0.35rem;
  border-radius: 0.45rem;
  background: rgba(28, 43, 40, 0.08);
  font-family: "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.message-attachments {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.8rem;
}

.message-attachments-kicker,
.composer-attachments-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-user .message-attachments-kicker {
  color: rgba(238, 245, 251, 0.8);
}

.message-attachment-list,
.composer-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.message-attachment-pill,
.composer-attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.38rem 0.72rem;
  border-radius: 999px;
  font-size: 0.86rem;
  line-height: 1.35;
}

.message-attachment-pill {
  color: #eef5fb;
  background: rgba(255, 255, 255, 0.14);
}

.workspace-change-set {
  display: grid;
  gap: 1rem;
  width: min(100%, 42rem);
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid rgba(45, 74, 66, 0.1);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.58);
}

.workspace-change-set-kicker,
.workspace-change-set-header-row,
.workspace-change-set-header h3,
.workspace-change-set-rationale,
.workspace-change-set-status-copy,
.workspace-change-set-status-badge,
.workspace-change-entry-file strong,
.workspace-change-entry-file span {
  margin: 0;
}

.workspace-change-set-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.workspace-change-set-kicker {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.workspace-change-set-header {
  display: grid;
  gap: 0.4rem;
}

.workspace-change-set-status-badge {
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.workspace-change-set-status-badge-proposed {
  color: #7b551f;
  background: rgba(201, 127, 16, 0.14);
}

.workspace-change-set-status-badge-applied {
  color: #17663e;
  background: rgba(46, 160, 67, 0.14);
}

.workspace-change-set-status-badge-rejected {
  color: #8a2f2b;
  background: rgba(207, 76, 67, 0.14);
}

.workspace-change-set-header h3 {
  font-size: 1rem;
}

.workspace-change-set-rationale,
.workspace-change-set-status-copy,
.workspace-change-entry-file span {
  color: var(--muted);
}

.workspace-change-entry {
  display: grid;
  gap: 0.75rem;
}

.workspace-change-entry-meta,
.workspace-change-set-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.workspace-change-entry-file {
  display: grid;
  gap: 0.12rem;
}

.workspace-change-entry-stats {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 700;
}

.workspace-change-entry-stat {
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
}

.workspace-change-entry-stat-added {
  color: #17663e;
  background: rgba(46, 160, 67, 0.14);
}

.workspace-change-entry-stat-removed {
  color: #9a2f22;
  background: rgba(248, 81, 73, 0.14);
}

.workspace-change-diff {
  overflow-x: auto;
  border: 1px solid rgba(13, 17, 23, 0.12);
  border-radius: 1rem;
  background: #0f1514;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.workspace-change-diff-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.workspace-change-diff-row {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.55;
}

.workspace-change-diff-line,
.workspace-change-diff-symbol {
  color: rgba(223, 235, 232, 0.5);
  user-select: none;
}

.workspace-change-diff-line {
  width: 3.1rem;
  padding: 0.24rem 0.55rem 0.24rem 0.35rem;
  border-right: 1px solid rgba(223, 235, 232, 0.06);
  text-align: right;
  vertical-align: top;
}

.workspace-change-diff-symbol {
  width: 1.8rem;
  padding: 0.24rem 0.35rem;
  border-right: 1px solid rgba(223, 235, 232, 0.06);
  text-align: center;
  vertical-align: top;
}

.workspace-change-diff-code {
  padding: 0.24rem 0.8rem;
  color: #eef5f2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.workspace-change-diff-row-context td {
  background: rgba(255, 255, 255, 0.02);
}

.workspace-change-diff-row-added td {
  background: rgba(46, 160, 67, 0.2);
}

.workspace-change-diff-row-removed td {
  background: rgba(248, 81, 73, 0.18);
}

.workspace-change-diff-row-added .workspace-change-diff-line,
.workspace-change-diff-row-added .workspace-change-diff-symbol {
  color: #8de0a3;
}

.workspace-change-diff-row-removed .workspace-change-diff-line,
.workspace-change-diff-row-removed .workspace-change-diff-symbol {
  color: #f2a19a;
}

.message-markdown pre code {
  padding: 0;
  background: transparent;
  white-space: pre;
}

.message-markdown table {
  display: block;
  width: max-content;
  min-width: 100%;
  max-width: 100%;
  margin: 0.9rem 0;
  border-collapse: collapse;
  overflow-x: auto;
}

.message-markdown th,
.message-markdown td {
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(45, 74, 66, 0.12);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
  word-break: normal;
}

.message-markdown a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
}

.message-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.28rem;
  border: 1px solid rgba(45, 74, 66, 0.12);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: 0 10px 20px rgba(34, 48, 44, 0.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-0.12rem);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

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

.message-assistant:hover .message-actions,
.message-assistant:focus-within .message-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.message-assistant[data-feedback-state="draft"] .message-actions,
.message-assistant[data-feedback-state="submitted"] .message-actions,
.message-assistant[data-feedback-state="submitted-fading"] .message-actions {
  display: none;
}

.message-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.message-action-button:hover,
.message-action-button:focus-visible {
  background: rgba(29, 107, 88, 0.1);
  color: var(--text);
}

.message-action-button:active {
  transform: scale(0.96);
}

.message-assistant[data-feedback="like"] [data-message-actions-feedback-param="like"],
.message-assistant[data-feedback="dislike"] [data-message-actions-feedback-param="dislike"],
.message-action-button[data-copy-state="copied"] {
  background: rgba(29, 107, 88, 0.14);
  color: var(--accent-strong);
}

.message-action-icon {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.message-feedback-form,
.message-feedback-confirmation {
  display: none;
}

.message-assistant[data-feedback-state="draft"] .message-feedback-form {
  display: grid;
  gap: 0.65rem;
  width: min(100%, 26rem);
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(45, 74, 66, 0.12);
  border-radius: 1rem;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: 0 10px 20px rgba(34, 48, 44, 0.08);
}

.message-assistant[data-feedback-state="submitted"] .message-feedback-confirmation {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  opacity: 1;
  transition: opacity 480ms ease;
}

.message-assistant[data-feedback-state="submitted-fading"] .message-feedback-confirmation {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  opacity: 0;
  transition: opacity 480ms ease;
}

.message-feedback-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.message-feedback-input {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(45, 74, 66, 0.14);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
}

.message-feedback-input:focus {
  outline: 2px solid rgba(29, 107, 88, 0.18);
  outline-offset: 2px;
}

.message-feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.message-feedback-button {
  min-height: 2.15rem;
  padding: 0 0.9rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #f7fbfa;
  cursor: pointer;
}

.message-feedback-button-secondary {
  background: rgba(45, 74, 66, 0.08);
  color: var(--text);
}

.streaming-indicator {
  display: inline-block;
  width: 0.65rem;
  height: 1rem;
  margin-left: 0.2rem;
  vertical-align: text-bottom;
  border-radius: 999px;
  background: currentColor;
  animation: pulse 1s ease-in-out infinite;
}

.composer-shell {
  position: sticky;
  bottom: 0;
  z-index: 15;
  padding: 0.9rem 0 0;
  background: transparent;
}

.composer-scroll-jump {
  position: absolute;
  left: 50%;
  top: -3.3rem;
  width: 2.8rem;
  height: 2.8rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(45, 74, 66, 0.14);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.96);
  color: var(--accent-strong);
  box-shadow: 0 14px 32px rgba(34, 48, 44, 0.12);
  cursor: pointer;
  transform: translateX(-50%);
}

.composer-scroll-jump[hidden] {
  display: none;
}

.composer-scroll-jump:hover {
  background: rgb(255, 250, 242);
  border-color: rgba(29, 107, 88, 0.22);
}

.composer-scroll-jump:focus-visible {
  outline: 2px solid rgba(29, 107, 88, 0.36);
  outline-offset: 3px;
}

.composer-scroll-jump-icon {
  width: 1.15rem;
  height: 1.15rem;
}

.composer-edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.75rem;
  padding: 0.8rem 0.95rem;
  border-radius: 1rem;
  color: rgba(28, 43, 40, 0.86);
  background: rgb(237, 242, 235);
  border: 1px solid rgba(29, 107, 88, 0.16);
}

.composer-edit-banner[hidden] {
  display: none;
}

.composer-edit-copy {
  font-size: 0.9rem;
}

.composer-edit-cancel {
  padding: 0.3rem 0.72rem;
  border: 0;
  border-radius: 999px;
  background: rgba(28, 43, 40, 0.08);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.composer-alert {
  margin-bottom: 0.75rem;
  padding: 0.8rem 0.95rem;
  border-radius: 1rem;
  color: var(--error);
  background: rgba(171, 77, 63, 0.08);
  border: 1px solid rgba(171, 77, 63, 0.18);
}

.composer-attachments {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgba(45, 74, 66, 0.1);
  border-radius: 1rem;
  background: rgba(255, 250, 242, 0.86);
}

.composer-attachment-pill {
  color: var(--text);
  background: rgba(29, 107, 88, 0.08);
}

.composer-attachment-label {
  font-weight: 600;
}

.composer-attachment-remove {
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.composer-form {
  position: relative;
  padding: 0.55rem;
  border: 1px solid rgba(45, 74, 66, 0.12);
  border-radius: 1.5rem;
  background: rgba(255, 250, 242, 0.92);
  box-shadow: 0 10px 24px rgba(34, 48, 44, 0.06);
}

.composer-input {
  width: 100%;
  min-height: 3.25rem;
  max-height: 13rem;
  padding: 0.9rem 4.7rem 0.9rem 0.95rem;
  border: 0;
  border-radius: 1.15rem;
  background: transparent;
  color: var(--text);
  resize: none;
  line-height: 1.5;
}

.composer-actions {
  display: flex;
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
}

.composer-submit {
  min-width: 3.35rem;
  min-height: 2.4rem;
  padding: 0 0.95rem;
  border: 0;
  border-radius: 999px;
  color: #f7fbfa;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  font-weight: 700;
  cursor: pointer;
}

.composer-submit:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.chat-panel-empty {
  min-height: 100vh;
}

.empty-state {
  width: min(100%, 30rem);
  margin: 0 auto;
  padding: 18vh 1.25rem 2rem;
}

.empty-state h2 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.empty-state-copy {
  margin: 0.85rem 0 1.6rem;
  font-size: 1rem;
  line-height: 1.5;
}

.flash-stack {
  position: fixed;
  top: 0.9rem;
  left: 50%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transform: translateX(-50%);
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.92);
  border: 1px solid rgba(45, 74, 66, 0.12);
  box-shadow: 0 12px 28px rgba(30, 44, 41, 0.12);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 180ms ease;
}

.flash-hidden {
  opacity: 0;
  transform: translateY(-0.25rem);
}

.flash-alert {
  color: var(--error);
}

.app-modal {
  width: min(100%, 28rem);
  max-width: calc(100vw - 1.5rem);
  padding: 0;
  border: 0;
  border-radius: 1.2rem;
  background: transparent;
  box-shadow: none;
}

.app-modal::backdrop {
  background: rgba(24, 34, 31, 0.32);
  backdrop-filter: blur(2px);
}

.app-modal-card {
  overflow: hidden;
  border: 1px solid rgba(45, 74, 66, 0.12);
  border-radius: 1.2rem;
  background: var(--surface-strong);
  box-shadow: 0 22px 54px rgba(30, 44, 41, 0.18);
}

.app-modal-header {
  padding: 1rem 1.2rem 0;
}

.app-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.app-modal-body {
  padding: 0.9rem 1.2rem 1.15rem;
}

.app-modal-description,
.app-modal-copy,
.app-modal-support {
  margin: 0;
  line-height: 1.55;
}

.app-modal-copy + .app-modal-support,
.app-modal-description + .app-modal-copy,
.app-modal-description + .app-modal-support {
  margin-top: 0.7rem;
}

.app-modal-support {
  color: var(--muted);
}

.app-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
  padding: 0.9rem 1.2rem 1.15rem;
  border-top: 1px solid rgba(45, 74, 66, 0.08);
}

.app-modal-action-form {
  margin: 0;
}

.app-modal-button {
  min-width: 5.6rem;
  min-height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid rgba(45, 74, 66, 0.14);
  border-radius: 999px;
  background: #fffdf9;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.app-modal-button-secondary {
  background: #fffdf9;
}

.app-modal-button-danger {
  border-color: rgba(190, 65, 49, 0.24);
  background: linear-gradient(135deg, #e14f3c, #ca3326);
  color: #fff8f6;
}

.app-modal-button:hover,
.app-modal-button:focus-visible {
  outline: 2px solid rgba(29, 107, 88, 0.18);
  outline-offset: 2px;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.25;
  }

  50% {
    opacity: 0.9;
  }
}

@media (max-width: 960px) {
  .app-layout,
  .app-layout[data-sidebar-state="closed"] {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-height);
    height: calc(100dvh - var(--topbar-height));
    width: min(17.5rem, calc(100vw - 1.25rem));
    box-shadow: var(--shadow);
    display: flex;
    transform: translateX(0);
  }

  .app-layout[data-sidebar-state="closed"] .app-sidebar {
    display: none;
  }

  .app-sidebar-backdrop {
    position: fixed;
    inset: var(--topbar-height) 0 0 0;
    z-index: 25;
    background: rgba(24, 34, 31, 0.28);
  }

  .app-sidebar-backdrop[hidden] {
    display: none;
  }

  .chat-topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding-inline: 0.95rem;
    padding-bottom: 0.7rem;
  }

  .chat-topbar-start {
    flex: 1 1 auto;
    min-width: 0;
  }

  .chat-topbar-copy {
    display: grid;
    gap: 0.08rem;
  }

  .chat-topbar-meta {
    width: 100%;
    justify-content: flex-start;
  }

  .chat-column {
    padding-inline: 0.95rem;
  }

  .empty-state {
    padding-top: 14vh;
  }

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

  .composer-shell {
    padding-top: 0.75rem;
  }

  .app-modal {
    max-width: calc(100vw - 1rem);
  }

  .app-modal-footer {
    gap: 0.55rem;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .linked-user-disclosure-summary {
    padding: 1.2rem 1.15rem;
  }

  .linked-user-disclosure-panel {
    padding: 0 1.15rem 1.15rem;
  }

  .linked-user-disclosure-indicator {
    margin-top: 0.65rem;
  }

  .settings-section-harness .settings-section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-section-harness .settings-toolbar-button {
    width: 100%;
    flex-basis: auto;
  }

  .settings-section-harness .settings-chat-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-section-harness .settings-chat-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-scroll {
    padding-bottom: 7.75rem;
  }

  .sidebar-account {
    align-items: stretch;
    flex-direction: column;
  }

  .sidebar-signout-button {
    width: 100%;
  }

  .chat-topbar-mark {
    display: none;
  }

  .chat-topbar h1 {
    white-space: normal;
    line-height: 1.15;
  }

  .topbar-action-chip,
  .skill-chip,
  .context-chip,
  .status-chip {
    min-height: 2rem;
  }

  .messages-canvas {
    gap: 1.15rem;
    padding-top: 1rem;
  }

  .composer-form {
    padding: 0.45rem;
    border-radius: 1.25rem;
  }

  .composer-scroll-jump {
    left: 50%;
    top: -3.05rem;
    width: 2.6rem;
    height: 2.6rem;
  }

  .composer-input {
    min-height: 3rem;
    padding: 0.85rem 4.2rem 0.85rem 0.85rem;
  }

  .composer-submit {
    min-width: 3rem;
    padding-inline: 0.8rem;
  }

  .empty-state {
    padding-top: 12vh;
  }
}
