:root {
  color-scheme: dark;
  --bg: #151817;
  --bg-warm: #171512;
  --surface: #1d211f;
  --surface-raised: #242521;
  --surface-soft: #29211d;
  --text: #f5e9e2;
  --text-muted: #c1b2ab;
  --text-subtle: rgba(193, 178, 171, 0.68);
  --border: rgba(194, 184, 178, 0.13);
  --border-strong: rgba(194, 184, 178, 0.24);
  --primary: #dcbf85;
  --primary-hover: #ddd78d;
  --primary-soft: rgba(220, 191, 133, 0.14);
  --primary-text: #404e4d;
  --secondary: #aabd8c;
  --secondary-soft: rgba(170, 189, 140, 0.14);
  --highlight: #d0d1ac;
  --danger: #f39b6d;
  --danger-text: #f5c7b3;
  --danger-soft: rgba(243, 155, 109, 0.14);
  --link: #d0d1ac;
  --warm-accent: #e3b5a4;
  --bubble-assistant: rgba(77, 80, 87, 0.42);
  --bubble-user: rgba(220, 191, 133, 0.1);
  --left-panel-width: 320px;
  --thread-width: 1040px;
  --composer-width: 1040px;
  --assistant-bubble-width: min(760px, 82%);
  --user-bubble-width: min(540px, 62%);
  --control-height: 42px;
  --controls-safe-top: 72px;
  --controls-safe-right: 116px;
  --composer-height: 60px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-panel: 0 24px 80px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(220, 191, 133, 0.08), transparent 26%),
    linear-gradient(180deg, #141210 0 140px, var(--bg) 140px 100%);
  color: var(--text);
  line-height: 1.55;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
textarea {
  font: inherit;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--primary-text);
  padding: 0.82rem 1.15rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
  box-shadow: 0 10px 20px rgba(220, 191, 133, 0.22);
}

button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.secondary-button {
  background: rgba(245, 233, 226, 0.06);
  color: var(--text);
  border: 1px solid rgba(194, 184, 178, 0.18);
  box-shadow: none;
}

.secondary-button:hover {
  background: rgba(245, 233, 226, 0.1);
}

.danger-button {
  background: var(--danger);
  color: #2e221b;
  box-shadow: 0 10px 20px rgba(243, 155, 109, 0.2);
}

.danger-button:hover {
  background: #f6b17c;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(194, 184, 178, 0.11);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  background: rgba(245, 233, 226, 0.045);
  color: var(--text);
  outline: 0;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

input:focus,
textarea:focus {
  border-color: rgba(220, 191, 133, 0.38);
  background: rgba(245, 233, 226, 0.06);
  box-shadow: 0 0 0 3px rgba(220, 191, 133, 0.08);
}

textarea {
  min-height: 210px;
  resize: vertical;
}

.shell {
  width: min(1280px, calc(100vw - 2rem));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(11, 14, 13, 0.88);
  border-bottom: 1px solid var(--border);
}

.topbar .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 78px;
}

.brand {
  display: grid;
  gap: 0.08rem;
}

.brand a {
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: 0.93rem;
}

.brand-kicker,
.eyebrow {
  color: var(--text-subtle);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-kicker {
  color: var(--text-subtle);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 0.9rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 700;
}

.nav-link:hover {
  background: rgba(245, 233, 226, 0.06);
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--primary-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(220, 191, 133, 0.24);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

.page-band {
  padding: 2.2rem 0 3rem;
}

.auth-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 48px 32px;
  background:
    radial-gradient(circle at 78% 10%, rgba(220, 191, 133, 0.1), transparent 34%),
    radial-gradient(circle at 18% 0%, rgba(100, 69, 54, 0.22), transparent 32%),
    var(--bg);
}

.flash-band {
  padding: 1rem 0 0;
}

.flash-list {
  display: grid;
  gap: 0.75rem;
}

.flash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  border-radius: var(--radius-sm);
  padding: 0.95rem 1rem;
  background: var(--danger-soft);
  color: var(--danger-text);
  border: 1px solid rgba(243, 155, 109, 0.24);
  box-shadow: var(--shadow-soft);
}

.flash[hidden] {
  display: none;
}

.flash-message {
  min-width: 0;
  overflow-wrap: anywhere;
}

.flash-close {
  width: 2rem;
  height: 2rem;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: currentColor;
  font-size: 1.35rem;
  line-height: 1;
  opacity: 0.72;
}

.flash-close:hover,
.flash-close:focus-visible {
  background: rgba(245, 233, 226, 0.08);
  color: currentColor;
  opacity: 1;
  transform: none;
}

.flash-success {
  background: var(--secondary-soft);
  color: var(--text);
  border-color: rgba(170, 189, 140, 0.24);
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.page-header h1,
.auth-copy h1 {
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1.04;
}

.page-header p,
.auth-copy p {
  margin: 0;
  max-width: 48rem;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.auth-brand-lockup {
  display: grid;
  gap: 0.75rem;
}

.auth-logo-row {
  display: flex;
  align-items: center;
  gap: 1.125rem;
}

.auth-logo-mark {
  width: clamp(60px, 4vw, 76px);
  height: clamp(60px, 4vw, 76px);
  flex: 0 0 clamp(60px, 4vw, 76px);
}

.auth-wordmark {
  color: var(--text);
  font-size: clamp(2.125rem, 2.6vw, 2.75rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.auth-tagline {
  margin-top: 6px;
  margin-left: clamp(78px, calc(4vw + 18px), 94px);
  color: rgba(193, 178, 171, 0.84);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.35;
}

.header-actions,
.status-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.status-pill,
.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.78rem;
  border-radius: 999px;
  background: var(--secondary-soft);
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 700;
}

.app-header {
  margin-bottom: 1.6rem;
}

.auth-layout,
.auth-forms,
.memory-grid,
.stat-grid,
.two-column,
.chat-layout {
  display: grid;
  gap: 1rem;
}

.auth-layout {
  width: min(1120px, calc(100vw - 96px));
  grid-template-columns: minmax(420px, 1fr) 410px;
  align-items: center;
  gap: 80px;
}

.auth-copy {
  display: grid;
  align-content: center;
}

.auth-forms {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-card {
  width: min(100%, 410px);
  display: grid;
  gap: 1.05rem;
  padding: 1.3rem;
  border: 1px solid rgba(194, 184, 178, 0.13);
  border-radius: 20px;
  background: rgba(29, 33, 31, 0.88);
  box-shadow: 0 28px 84px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(194, 184, 178, 0.1);
  border-radius: 16px;
  background: rgba(245, 233, 226, 0.035);
}

.auth-tab {
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: 12px;
  background: transparent;
  color: rgba(245, 233, 226, 0.68);
  font-size: 0.86rem;
  font-weight: 850;
  box-shadow: none;
}

.auth-tab:hover {
  background: rgba(245, 233, 226, 0.06);
  color: var(--text);
  transform: none;
}

.auth-tab.active {
  background: rgba(220, 191, 133, 0.2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(220, 191, 133, 0.2);
}

.auth-panel {
  display: grid;
  gap: 1rem;
}

.auth-panel h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1.1;
}

.auth-form-actions {
  display: grid;
  gap: 0.65rem;
}

.auth-link-button {
  min-height: auto;
  justify-self: start;
  margin-top: 0.2rem;
  padding: 0.1rem 0;
  border-radius: 0;
  background: transparent;
  color: rgba(193, 178, 171, 0.78);
  box-shadow: none;
  font-size: 0.8125rem;
  font-weight: 800;
  line-height: 1.2;
}

.auth-link-button:hover {
  background: transparent;
  color: var(--primary);
  transform: none;
}

.auth-card input {
  min-height: 48px;
}

.auth-card button[type="submit"] {
  min-height: 48px;
}

.forgot-password-link {
  margin-top: 0.2rem;
}

.stat-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.memory-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.memory-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  background:
    linear-gradient(135deg, rgba(220, 191, 133, 0.075), rgba(170, 189, 140, 0.035)),
    var(--surface);
}

.memory-context p {
  max-width: 66rem;
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  line-height: 1.55;
}

.memory-context-counts {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.memory-context-counts span {
  min-height: 2.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0 0.75rem;
  border: 1px solid rgba(194, 184, 178, 0.12);
  border-radius: 999px;
  background: rgba(245, 233, 226, 0.035);
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 760;
  white-space: nowrap;
}

.memory-context-counts strong {
  color: var(--text);
  font-weight: 900;
}

.chat-shell {
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.88fr);
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  padding: 1.15rem;
}

.panel h2,
.panel h3 {
  margin: 0;
  color: var(--text);
}

.panel-subtitle {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-heading .meta-chip {
  margin-left: auto;
}

.card-muted-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  opacity: 0.58;
}

.panel-heading-tight {
  margin-bottom: 0.9rem;
}

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

.auth-subform {
  margin-top: 1.05rem;
  padding-top: 1.05rem;
  border-top: 1px solid rgba(194, 184, 178, 0.12);
}

.auth-subform[hidden],
.auth-panel[hidden] {
  display: none;
}

.stack-form label {
  display: grid;
  gap: 0.45rem;
}

.stack-form span,
.stat-label,
.message-label,
.meta-list dt {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.stat-panel {
  padding: 1rem 1.05rem;
  background: var(--surface-raised);
}

.stat-panel strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.6rem;
  line-height: 1.05;
}

.transcript-list,
.object-list {
  display: grid;
  gap: 0.9rem;
}

.transcript-scroll {
  max-height: 67vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.message-cluster {
  display: grid;
  gap: 0.6rem;
}

.compact-cluster {
  gap: 0.45rem;
}

.message-row {
  display: flex;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.monday {
  justify-content: flex-start;
}

.message-bubble {
  display: grid;
  gap: 0.28rem;
  max-width: min(100%, 46rem);
  padding: 0.95rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
}

.message-row.user .message-bubble {
  background: var(--accent-soft);
  border-color: rgba(15, 138, 120, 0.18);
}

.message-row.monday .message-bubble {
  background: #fff;
}

.message-bubble p,
.object-list p,
.response-block p {
  margin: 0;
}

.message-label {
  margin: 0;
}

.transcript-panel {
  min-height: 38rem;
}

.composer-panel {
  position: sticky;
  top: 96px;
}

.composer-form {
  gap: 1.1rem;
}

.composer-label textarea {
  min-height: 18rem;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.composer-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.response-block,
.inspection-block,
.object-list li {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.response-block {
  margin-top: 1rem;
  display: grid;
  gap: 0.45rem;
  border-left: 4px solid var(--primary);
}

.inspection-block {
  margin-top: 1rem;
}

.object-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.object-list li {
  display: grid;
  gap: 0.3rem;
}

.object-list li span {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.meta-list {
  display: grid;
  gap: 0.85rem;
}

.meta-list div {
  display: grid;
  gap: 0.18rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.meta-list dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.meta-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.empty-state {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  color: var(--text-muted);
  line-height: 1.48;
}

.empty-state strong {
  color: var(--text);
  font-weight: 850;
}

.empty-state p {
  margin: 0;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  color: var(--text);
}

body.app-body,
body.app-body main {
  height: 100dvh;
  overflow: hidden;
}

body.app-body {
  background: var(--bg);
  color: var(--text);
}

body.app-body .flash-band {
  position: fixed;
  top: 1rem;
  left: calc(var(--left-panel-width) + 1rem);
  right: 1rem;
  z-index: 60;
  padding: 0;
  pointer-events: none;
}

body.app-layout-focus .flash-band {
  left: 1rem;
}

body.app-body .flash-list {
  pointer-events: auto;
}

.app-shell {
  position: relative;
  height: 100dvh;
  width: 100vw;
  display: grid;
  grid-template-columns: var(--left-panel-width) minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

.app-shell[data-view="split"] {
  --thread-width: 1040px;
  --composer-width: 1040px;
  --assistant-bubble-width: min(760px, 82%);
  --user-bubble-width: min(540px, 62%);
}

.app-shell[data-view="focus"] {
  --thread-width: min(1400px, calc(100vw - 220px));
  --composer-width: min(1220px, calc(100vw - 260px));
  --assistant-bubble-width: min(900px, 78%);
  --user-bubble-width: min(680px, 58%);
}

.app-shell.focus-mode {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell.focus-mode .sidebar {
  display: none;
}

.sidebar {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.9rem;
  padding: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.sidebar-brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.sidebar-brand-name {
  min-width: 0;
  color: var(--text);
  font-size: 1.42rem;
  font-weight: 800;
  line-height: 1;
}

.sidebar-brand-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.sidebar-actions,
.sidebar-primary-form {
  margin: 0;
}

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

.sidebar-primary-button {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0 0.95rem;
  border-radius: var(--radius-md);
  width: 100%;
  justify-content: flex-start;
  background: rgba(245, 233, 226, 0.06);
  color: var(--text);
  border: 1px solid rgba(194, 184, 178, 0.18);
  box-shadow: none;
  font-weight: 800;
}

.sidebar-primary-button:hover {
  background: rgba(245, 233, 226, 0.1);
  text-decoration: none;
}

.sidebar-utility-links {
  display: grid;
}

.sidebar-utility-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.45rem;
  padding: 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-weight: 700;
}

.sidebar-utility-link:hover,
.sidebar-utility-link.active {
  color: var(--text);
  text-decoration: none;
  border-color: rgba(170, 189, 140, 0.24);
  background: var(--secondary-soft);
}

.sidebar-scroll {
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(193, 178, 171, 0.34) transparent;
  display: grid;
  align-content: start;
  gap: 0.95rem;
  padding-right: 0.45rem;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 8px;
}

.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(193, 178, 171, 0.28);
  border-radius: 999px;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(193, 178, 171, 0.42);
}

.sidebar-section {
  display: grid;
  min-width: 0;
  gap: 0.62rem;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0 0.25rem 0.5rem 0;
  border-bottom: 1px solid rgba(194, 184, 178, 0.12);
}

.sidebar-section-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 850;
}

.sidebar-section-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.sidebar-count {
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(245, 233, 226, 0.045);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.sidebar-section-toggle {
  min-height: 22px;
  padding: 0 0.52rem;
  border: 1px solid rgba(194, 184, 178, 0.1);
  border-radius: 999px;
  background: rgba(245, 233, 226, 0.025);
  color: var(--text-subtle);
  font-size: 0.72rem;
  font-weight: 850;
  box-shadow: none;
}

.sidebar-section-toggle:hover {
  color: var(--text);
  border-color: rgba(194, 184, 178, 0.18);
  background: rgba(245, 233, 226, 0.06);
  transform: none;
}

.sidebar-section-panel[hidden] {
  display: none;
}

.sidebar-section.is-collapsed {
  gap: 0;
}

.session-card-list {
  display: grid;
  min-width: 0;
  gap: 0.48rem;
}

.session-card {
  display: block;
  min-width: 0;
  overflow: hidden;
  min-height: 50px;
  padding: 0.72rem 0.85rem;
  border: 1px solid rgba(194, 184, 178, 0.1);
  border-radius: 13px;
  background: rgba(245, 233, 226, 0.025);
  color: var(--text);
  text-decoration: none;
}

.session-card:hover {
  text-decoration: none;
  border-color: rgba(194, 184, 178, 0.22);
  background: rgba(255, 255, 255, 0.05);
}

.session-card.active {
  background: rgba(170, 189, 140, 0.09);
  border-color: rgba(170, 189, 140, 0.34);
  box-shadow: inset 3px 0 0 rgba(170, 189, 140, 0.72);
}

.session-card.history {
  min-height: 46px;
  padding-block: 0.68rem;
  background: rgba(255, 255, 255, 0.01);
}

.session-card-list.history .session-card {
  opacity: 0.82;
}

.session-card-list.history .session-card:hover {
  opacity: 1;
}

.session-card-title {
  margin: 0;
  display: block;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.25;
  font-weight: 750;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar-empty {
  color: var(--text-subtle);
  font-size: 0.86rem;
  padding: 0.25rem 0 0.45rem;
}

.main {
  min-height: 0;
  min-width: 0;
  display: flex;
  overflow: hidden;
  background: transparent;
}

.workspace-shell {
  position: relative;
  min-height: 0;
  min-width: 0;
  flex: 1;
  display: flex;
  overflow: hidden;
}

.workspace-toolbar {
  position: absolute;
  top: 18px;
  right: 22px;
  z-index: 40;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: transparent;
}

.workspace-controls {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.workspace-controls-group {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.workspace-controls-group + .workspace-controls-group {
  padding-top: 0;
  border-top: 0;
}

.workspace-controls-group-global {
  gap: 10px;
}

.viewport-toggle {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(194, 184, 178, 0.14);
  border-radius: 18px;
  background: rgba(29, 33, 31, 0.72);
  backdrop-filter: blur(10px);
}

.viewport-toggle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 42px;
  min-width: 72px;
  padding: 0 12px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow: none;
}

.viewport-toggle-button:hover {
  color: var(--text);
  text-decoration: none;
  background: rgba(245, 233, 226, 0.06);
  transform: none;
}

.viewport-toggle-button.active {
  background: rgba(220, 191, 133, 0.22);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(220, 191, 133, 0.24);
}

.workspace-control-form {
  position: relative;
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 7px;
}

.workspace-end-button,
.workspace-icon-button,
.workspace-avatar-button,
.workspace-menu-button {
  min-height: var(--control-height);
  border-radius: 999px;
}

.workspace-end-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  min-width: 46px;
  padding: 0 14px;
  gap: 0;
  background: rgba(243, 155, 109, 0.12);
  color: var(--danger);
  border: 1px solid rgba(243, 155, 109, 0.26);
  box-shadow: none;
  font-size: 0.88rem;
  font-weight: 800;
}

.workspace-end-button:hover {
  background: var(--danger-soft);
  color: var(--danger-text);
  border-color: rgba(243, 155, 109, 0.34);
  transform: none;
}

.workspace-end-button[aria-expanded="true"] {
  background: rgba(243, 155, 109, 0.16);
  border-color: rgba(243, 155, 109, 0.34);
  color: var(--danger);
}

.workspace-end-confirm {
  position: absolute;
  right: calc(100% + 14px);
  bottom: 0;
  z-index: 70;
  display: grid;
  justify-items: stretch;
  width: 280px;
  gap: 0;
  padding: 16px;
  border: 1px solid rgba(243, 155, 109, 0.22);
  border-radius: 18px;
  background: rgba(29, 33, 31, 0.96);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(14px);
}

.workspace-end-confirm::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: 16px;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  background: rgba(29, 33, 31, 0.96);
  border-top: 1px solid rgba(243, 155, 109, 0.22);
  border-right: 1px solid rgba(243, 155, 109, 0.22);
}

.workspace-end-confirm[hidden] {
  display: none;
}

.workspace-end-confirm-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 850;
  line-height: 1.25;
  margin-bottom: 5px;
}

.workspace-end-confirm-copy {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.workspace-end-processing {
  position: absolute;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(10, 12, 11, 0.34);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

.workspace-end-processing[hidden] {
  display: none;
}

.workspace-end-processing-card {
  width: fit-content;
  min-width: 350px;
  max-width: min(400px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: 44px auto;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border: 1px solid rgba(220, 191, 133, 0.16);
  border-radius: 24px;
  background: rgba(29, 33, 31, 0.94);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}

.workspace-end-loading-wrap {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.workspace-end-processing-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.15;
}

.workspace-end-processing-copy {
  margin-top: 5px;
  color: #d0c2ba;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.processing-dots::after {
  content: "";
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: processing-dots 2.4s steps(4, end) infinite;
}

@keyframes processing-dots {
  0% {
    content: "";
  }

  25% {
    content: ".";
  }

  50% {
    content: "..";
  }

  75%,
  100% {
    content: "...";
  }
}

.workspace-end-loading-mark {
  width: 40px;
  height: 40px;
  transform-origin: center;
  animation: spineframe-processing 2.1s ease-in-out infinite;
}

@keyframes spineframe-processing {
  0% {
    opacity: 0.72;
    transform: scale(0.92);
    filter: drop-shadow(0 0 0 rgba(220, 191, 133, 0));
  }

  45% {
    opacity: 1;
    transform: scale(1.05);
    filter:
      drop-shadow(0 0 12px rgba(220, 191, 133, 0.28))
      drop-shadow(0 0 24px rgba(170, 189, 140, 0.12));
  }

  100% {
    opacity: 0.72;
    transform: scale(0.92);
    filter: drop-shadow(0 0 0 rgba(220, 191, 133, 0));
  }
}

@media (prefers-reduced-motion: reduce) {
  .workspace-end-loading-mark {
    animation: none;
    opacity: 1;
    transform: none;
    filter: drop-shadow(0 0 8px rgba(220, 191, 133, 0.16));
  }

  .processing-dots::after {
    animation: none;
    content: "...";
  }
}

.workspace-end-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.workspace-confirm-cancel {
  min-height: auto;
  padding: 8px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}

.workspace-confirm-cancel:hover {
  background: rgba(245, 233, 226, 0.06);
  color: var(--text);
  transform: none;
}

.workspace-end-confirm-submit {
  min-height: auto;
  padding: 8px 12px;
  border: 1px solid rgba(243, 155, 109, 0.3);
  border-radius: 11px;
  background: rgba(243, 155, 109, 0.14);
  box-shadow: none;
  color: var(--danger);
  font-size: 13px;
  font-weight: 850;
}

.workspace-end-confirm-submit:hover {
  background: rgba(243, 155, 109, 0.22);
  color: var(--danger);
  transform: none;
}

.workspace-end-confirm-submit:disabled,
.workspace-confirm-cancel:disabled,
.workspace-end-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.workspace-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  background: rgba(29, 33, 31, 0.78);
  color: var(--text);
  border: 1px solid rgba(194, 184, 178, 0.16);
  box-shadow: none;
  font-size: 1rem;
  backdrop-filter: blur(10px);
}

.workspace-icon-button:hover,
.workspace-icon-button.active {
  color: var(--text);
  text-decoration: none;
  border-color: rgba(220, 191, 133, 0.24);
  background: var(--primary-soft);
}

.workspace-avatar-menu {
  position: relative;
}

.workspace-avatar-menu summary {
  list-style: none;
}

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

.workspace-avatar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(194, 184, 178, 0.16);
  background: rgba(29, 33, 31, 0.78);
  color: var(--text);
  box-shadow: none;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.workspace-avatar-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.workspace-avatar-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 0.55rem);
  min-width: 180px;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 0.55rem;
  z-index: 30;
}

.workspace-avatar-name {
  margin: 0;
  color: var(--text);
  font-weight: 800;
}

.workspace-avatar-id {
  margin: -0.45rem 0 0.1rem;
  color: var(--text-subtle);
  font-size: 0.82rem;
  font-weight: 700;
}

.workspace-menu-link,
.workspace-menu-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: none;
}

.workspace-menu-link:hover,
.workspace-menu-button:hover {
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
}

.workspace-content {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex: 1;
}

.settings-modal-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 28px;
}

.settings-modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 9, 0.62);
  backdrop-filter: blur(10px);
}

.settings-modal-window {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 56px));
  height: min(86dvh, 820px);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(194, 184, 178, 0.14);
  border-radius: 24px;
  background: rgba(29, 33, 31, 0.94);
  box-shadow: 0 28px 84px rgba(0, 0, 0, 0.42);
}

.settings-modal-sidebar {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 1.25rem;
  padding: 1.35rem 1.1rem;
  border-right: 1px solid rgba(194, 184, 178, 0.1);
  background: rgba(36, 37, 33, 0.78);
}

.settings-modal-profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.9rem;
}

.settings-modal-avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(220, 191, 133, 0.14);
  border: 1px solid rgba(220, 191, 133, 0.24);
  color: var(--text);
  font-weight: 800;
}

.settings-modal-display-name,
.settings-modal-user-id {
  margin: 0;
}

.settings-modal-display-name {
  color: var(--text);
  font-weight: 800;
}

.settings-modal-user-id {
  color: var(--text-subtle);
  font-size: 0.9rem;
}

.settings-modal-nav {
  display: grid;
  gap: 0.45rem;
}

.settings-modal-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 2.8rem;
  padding: 0 0.9rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
}

.settings-modal-nav-link:hover,
.settings-modal-nav-link.active {
  color: var(--text);
  text-decoration: none;
  background: rgba(245, 233, 226, 0.08);
  transform: none;
}

.settings-modal-body {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.settings-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.35rem 1rem;
  border-bottom: 1px solid rgba(194, 184, 178, 0.1);
}

.settings-modal-header h2 {
  margin: 0.18rem 0 0;
  color: var(--text);
  font-size: 1.65rem;
}

.settings-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 0.95rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 700;
}

.settings-modal-close:hover {
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
}

.settings-modal-scroll {
  min-height: 0;
  overflow-y: auto;
  padding: 1.2rem 1.35rem 1.35rem;
  display: grid;
  align-content: start;
  gap: 1.4rem;
}

.settings-modal-section {
  display: grid;
  gap: 0.8rem;
}

.settings-modal-section[hidden] {
  display: none;
}

.settings-modal-section-header h3 {
  margin: 0.18rem 0 0;
  color: var(--text);
  font-size: 1.2rem;
}

.settings-modal-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid rgba(194, 184, 178, 0.1);
  border-radius: 18px;
  background: rgba(36, 37, 33, 0.78);
}

.settings-modal-list {
  display: grid;
  gap: 0.85rem;
  margin: 0;
}

.settings-modal-list div {
  display: grid;
  gap: 0.18rem;
}

.settings-modal-list dt {
  color: var(--text-subtle);
  font-size: 0.84rem;
  font-weight: 700;
}

.settings-modal-list dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.settings-modal-reset-form {
  margin: 0;
}

.settings-form {
  display: grid;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(194, 184, 178, 0.1);
}

.settings-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.settings-field {
  display: grid;
  gap: 0.38rem;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.settings-field input {
  min-height: 2.8rem;
  padding: 0.72rem 0.82rem;
  border-radius: 12px;
  background: rgba(21, 24, 23, 0.78);
}

.settings-help {
  margin: 0;
  color: var(--text-subtle);
  font-size: 0.88rem;
}

.settings-inline-actions {
  display: flex;
  justify-content: flex-start;
  gap: 0.7rem;
}

.main-chat,
.main-view {
  min-height: 0;
  min-width: 0;
  flex: 1;
  display: grid;
  overflow: hidden;
}

.main-chat {
  position: relative;
  grid-template-rows: minmax(0, 1fr);
}

.main-view {
  grid-template-rows: minmax(0, 1fr);
}

.view-header {
  min-height: 64px;
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
}

.thread-scroll,
.main-view-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
}

.thread-scroll.has-messages {
  display: block;
  padding-top: var(--controls-safe-top);
  padding-bottom: calc(var(--composer-height, 96px) + 84px);
  scroll-padding-top: var(--controls-safe-top);
  scroll-padding-bottom: calc(var(--composer-height, 96px) + 84px);
}

.thread-scroll.is-empty {
  display: grid;
  place-items: center;
  padding: 24px 24px clamp(80px, 12vh, 140px);
}

.messages-inner {
  width: min(100%, var(--thread-width));
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 42px;
  justify-content: flex-start;
}

.message-row {
  display: flex;
  width: 100%;
  margin: 0.1rem 0;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.assistant {
  justify-content: flex-start;
}

.message-stack {
  display: grid;
  gap: 6px;
  max-width: var(--assistant-bubble-width);
}

.message-stack.user {
  justify-items: end;
  max-width: var(--user-bubble-width);
}

.message-stack.assistant {
  justify-items: start;
}

.message-bubble {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  line-height: 1.55;
}

.message-bubble p {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  padding-inline: 6px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.message-actions[hidden] {
  display: none;
}

.message-row:hover .message-actions,
.message-row:focus-within .message-actions {
  opacity: 1;
  transform: translateY(0);
}

.message-confirm {
  display: grid;
  gap: 3px;
  justify-content: flex-end;
  justify-self: end;
  width: fit-content;
  max-width: min(420px, 100%);
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(243, 155, 109, 0.22);
  border-radius: 16px;
  background: rgba(243, 155, 109, 0.075);
  color: var(--text);
}

.message-confirm[hidden] {
  display: none;
}

.message-confirm-title {
  color: var(--text);
  font-weight: 850;
  line-height: 1.25;
}

.message-confirm-copy {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
  text-align: right;
}

.message-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.confirm-cancel,
.confirm-delete {
  min-height: auto;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 850;
}

.confirm-cancel {
  border: 0;
  background: rgba(245, 233, 226, 0.04);
  color: var(--text-muted);
}

.confirm-cancel:hover {
  background: rgba(245, 233, 226, 0.075);
  color: var(--text);
}

.confirm-delete {
  border: 1px solid rgba(243, 155, 109, 0.28);
  background: rgba(243, 155, 109, 0.14);
  color: var(--danger);
}

.confirm-delete:hover {
  background: rgba(243, 155, 109, 0.22);
  color: var(--danger);
}

.message-action,
.message-edit-cancel {
  min-height: auto;
  padding: 2px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-subtle);
  font-size: 13px;
  font-weight: 800;
}

.message-action:hover,
.message-edit-cancel:hover {
  background: transparent;
  color: var(--primary);
  transform: none;
}

.message-action.danger:hover {
  color: var(--danger);
}

.message-edit-form {
  display: grid;
  gap: 0.65rem;
  width: min(520px, 78vw);
  padding: 0.7rem;
  border: 1px solid rgba(194, 184, 178, 0.12);
  border-radius: 16px;
  background: rgba(29, 33, 31, 0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.message-edit-form[hidden] {
  display: none;
}

.message-edit-input {
  min-height: 84px;
  resize: vertical;
  border-radius: 14px;
  background: rgba(21, 24, 23, 0.72);
}

.message-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
}

.message-edit-submit {
  min-height: 2.4rem;
  padding: 0 0.9rem;
  border-radius: 12px;
  font-size: 0.86rem;
}

.message-bubble.user {
  width: fit-content;
  min-width: 44px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--bubble-user);
  border-color: rgba(220, 191, 133, 0.22);
  white-space: pre-wrap;
}

.message-bubble.assistant {
  width: fit-content;
  max-width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bubble-assistant);
  border-color: rgba(184, 196, 187, 0.14);
}

@media (hover: none) {
  .message-actions {
    opacity: 1;
    transform: none;
  }
}

.empty-thread-state {
  display: grid;
  gap: 0.55rem;
  width: min(100%, var(--thread-width));
  max-width: 34rem;
  margin: auto;
  text-align: center;
  padding: 4rem 1.25rem;
}

.thread-status-chip {
  display: inline-flex;
  align-items: center;
  align-self: center;
  width: fit-content;
  min-height: 2rem;
  padding: 0 0.82rem;
  border-radius: 999px;
  background: rgba(245, 233, 226, 0.045);
  border: 1px solid rgba(194, 184, 178, 0.14);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.empty-thread-state h2 {
  margin: 0;
  color: var(--text);
  font-size: 2rem;
}

.empty-thread-state p {
  margin: 0;
  color: var(--text-muted);
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.8rem;
}

.empty-action {
  display: inline-flex;
  align-items: center;
  min-height: 2.3rem;
  padding: 0 0.95rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(245, 233, 226, 0.05);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.empty-action:hover {
  color: var(--text);
  text-decoration: none;
  border-color: rgba(170, 189, 140, 0.4);
  background: var(--secondary-soft);
}

.composer-region {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  z-index: 20;
  pointer-events: none;
  padding: 0 1.35rem;
  background: transparent;
}

.composer-inner {
  width: min(var(--composer-width), 100%);
  margin: 0 auto 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: flex-end;
  padding: 8px;
  border: 1px solid rgba(194, 184, 178, 0.12);
  border-radius: 20px;
  background: rgba(29, 33, 31, 0.82);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
}

.composer-inner:focus-within {
  border-color: rgba(220, 191, 133, 0.34);
}

.ended-conversation-notice {
  width: min(var(--composer-width), 100%);
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(220, 191, 133, 0.18);
  border-radius: 18px;
  background: rgba(29, 33, 31, 0.82);
  color: var(--text-muted);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
}

.ended-conversation-title {
  color: var(--text);
  font-weight: 850;
  line-height: 1.25;
}

.ended-conversation-copy {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
  margin-top: 0.12rem;
}

.ended-conversation-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 1rem;
  border: 1px solid rgba(220, 191, 133, 0.28);
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--text);
  font-weight: 850;
  white-space: nowrap;
}

.ended-conversation-action:hover {
  color: var(--text);
  text-decoration: none;
  background: rgba(220, 191, 133, 0.2);
}

.thread-pending {
  width: min(100%, var(--thread-width));
  margin: 0 auto 1.15rem;
  padding-top: 1.15rem;
  padding-inline: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.thread-pending[hidden] {
  display: none;
}

.pending-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.pending-dots span {
  width: 0.32rem;
  height: 0.32rem;
  border-radius: 999px;
  background: var(--primary);
  opacity: 0.32;
  animation: pending-dot 1.2s ease-in-out infinite;
}

.pending-dots span:nth-child(2) {
  animation-delay: 140ms;
}

.pending-dots span:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes pending-dot {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.composer-input-stack {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.input-box {
  flex: 1;
  min-height: 44px;
  height: 44px;
  max-height: 168px;
  resize: none;
  overflow-y: hidden;
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: 0;
  padding: 11px 14px;
  line-height: 1.45;
  box-shadow: none;
}

.input-box::placeholder {
  color: rgba(184, 196, 187, 0.65);
}

.input-box:focus {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.composer-counter {
  justify-self: start;
  padding-left: 16px;
  color: var(--text-subtle);
  font-size: 0.82rem;
  font-weight: 700;
}

.composer-status {
  justify-self: start;
  padding-left: 16px;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 750;
}

.composer-status[hidden],
.composer-counter[hidden] {
  display: none;
}

.send-button {
  flex-shrink: 0;
  min-width: 72px;
  height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  color: var(--primary-text);
  align-self: end;
}

.send-button:focus-visible {
  outline: 2px solid var(--highlight);
  outline-offset: 3px;
}

.send-button:disabled,
.send-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  filter: saturate(0.74);
  transform: none;
}

.send-button:disabled:hover,
.send-button[aria-disabled="true"]:hover {
  transform: none;
}

.inspection-drawer {
  margin-top: 0.5rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

.inspection-drawer summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}

.inspection-drawer pre {
  margin-top: 0.85rem;
  color: rgba(245, 233, 226, 0.86);
}

.main-view-scroll {
  padding: 1.35rem calc(1.35rem + var(--controls-safe-right)) 1.35rem 1.35rem;
}

.view-header {
  padding: 0 0 1.25rem;
  border-bottom: 0;
  background: transparent;
}

.view-header h1 {
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(2rem, 3vw, 2.8rem);
  line-height: 1.04;
}

.view-header p {
  margin: 0;
  color: var(--text-muted);
}

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

@media (max-width: 1120px) {
  .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .auth-layout,
  .memory-grid,
  .two-column {
    grid-template-columns: 1fr;
  }

  .memory-context {
    align-items: flex-start;
    flex-direction: column;
  }

  .memory-context-counts {
    justify-content: flex-start;
  }

  .auth-layout {
    gap: 28px;
  }
}

@media (max-width: 820px) {
  body.app-body .flash-band {
    left: 1rem;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    grid-template-rows: auto auto minmax(0, 220px);
  }

  .workspace-toolbar {
    top: 12px;
    right: 12px;
  }

  .main-view-scroll {
    padding: calc(1rem + var(--controls-safe-top)) 1rem 1rem;
  }

  .empty-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .composer-inner {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .send-button {
    width: 100%;
  }

  .message-bubble.user,
  .message-bubble.assistant {
    max-width: 88%;
  }

  .settings-modal-layer {
    padding: 14px;
  }

  .settings-modal-window {
    width: calc(100vw - 28px);
    height: min(88dvh, 900px);
    grid-template-columns: 1fr;
  }

  .settings-modal-sidebar {
    gap: 0.9rem;
    border-right: 0;
    border-bottom: 1px solid rgba(194, 184, 178, 0.1);
  }

  .settings-modal-nav {
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
  }

  .settings-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .workspace-end-confirm {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 18px;
    width: auto;
  }

  .workspace-end-confirm::after {
    display: none;
  }

  body {
    background: var(--bg);
  }

  .workspace-toolbar {
    padding-inline: 0.85rem;
  }

  .topbar .shell,
  .topbar-meta {
    align-items: stretch;
  }

  .topbar .shell,
  .topbar-meta {
    flex-direction: column;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shell {
    width: min(100vw - 1rem, 1280px);
  }

  .page-band {
    padding-top: 1.35rem;
  }

  .auth-page {
    padding: 28px 16px;
  }
}
