:root {
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #090d16;
  --surface: #101726;
  --surface-high: #182235;
  --surface-highest: #212d44;
  --primary: #2dd4bf;
  --primary-fg: #042f2e;
  --primary-container: #0f766e;
  --primary-container-fg: #ccfbf1;
  --secondary: #818cf8;
  --secondary-container: #312e81;
  --secondary-container-fg: #e0e7ff;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --outline: #2d3b55;
  --error: #fca5a5;
  --error-bg: #7f1d1d;
  --error-solid: #dc2626;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-high: #eff3f8;
  --surface-highest: #e2e8f0;
  --primary: #0d9488;
  --primary-fg: #ffffff;
  --primary-container: #ccfbf1;
  --primary-container-fg: #0f766e;
  --secondary: #4f46e5;
  --secondary-container: #e0e7ff;
  --secondary-container-fg: #312e81;
  --text: #0f172a;
  --text-muted: #475569;
  --outline: #cbd5e1;
  --error: #b91c1c;
  --error-bg: #fee2e2;
  --error-solid: #dc2626;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

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

button,
input,
textarea,
select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.app-root {
  min-height: 100dvh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

/* Splash / Restoring */
.center-screen {
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.restore-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.brand-logo-lg {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

.brand-logo-sm {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--outline);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

.muted-small {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 2px 0 0;
}

/* Auth Screen */
.auth-screen {
  height: 100dvh;
  overflow-y: auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

.auth-container {
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-name {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.auth-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--outline);
  background: linear-gradient(135deg, #0d1628 0%, #15233d 55%, #19254b 100%);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: #f8fafc;
}

.auth-hero-glow {
  position: absolute;
  inset: -40% -20% auto auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.32), transparent 70%);
  pointer-events: none;
}

.auth-hero-emblem {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.auth-title {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-list li {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  font-size: 0.93rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.feature-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-container);
  color: var(--primary-container-fg);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.primary-cta-btn {
  min-height: 52px;
  width: 100%;
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--primary-fg);
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
}

.primary-cta-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* Workspace Layout */
.workspace {
  display: flex;
  height: 100dvh;
  width: 100%;
  position: relative;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.58);
  z-index: 30;
}

.sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  gap: 10px;
  z-index: 40;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
}

.new-chat-btn,
.memories-nav-btn {
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--outline);
  background: var(--surface-high);
  padding: 0 14px;
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.new-chat-btn {
  background: var(--primary-container);
  color: var(--primary-container-fg);
  border-color: transparent;
}

.count-badge {
  margin-left: auto;
  background: var(--surface-highest);
  color: var(--text);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.78rem;
}

.search-input {
  width: 100%;
  min-height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--outline);
  background: var(--bg);
  padding: 0 12px;
  font-size: 0.9rem;
}

.section-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 4px 0;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}

.chat-item:hover {
  background: var(--surface-high);
}

.chat-item.active {
  background: var(--surface-highest);
  border-color: var(--outline);
}

.chat-item-body {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
}

.chat-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-preview {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.chat-item-actions {
  display: flex;
  gap: 2px;
}

.sidebar-footer {
  border-top: 1px solid var(--outline);
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.avatar-img,
.avatar-fallback {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.avatar-fallback {
  background: var(--primary-container);
  color: var(--primary-container-fg);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.user-meta {
  min-width: 0;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.footer-actions {
  display: flex;
  gap: 4px;
}

/* Main Chat Pane */
.main-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--bg);
}

.topbar {
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--outline);
  background: var(--bg);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.pill-btn {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: var(--surface-high);
  font-size: 0.82rem;
  font-weight: 600;
}

.icon-btn {
  min-width: 42px;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}

.icon-btn:hover {
  background: var(--surface-high);
}

.danger-icon-btn {
  color: var(--error);
}

.icon-btn-sm {
  min-width: 34px;
  min-height: 34px;
  border-radius: 8px;
  border: none;
  background: transparent;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
}

.icon-btn-sm:hover {
  background: var(--surface-highest);
}

.setup-banner {
  margin: 10px auto 0;
  max-width: 780px;
  width: calc(100% - 24px);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--secondary);
  background: var(--secondary-container);
  color: var(--secondary-container-fg);
  font-size: 0.86rem;
}

.setup-banner p {
  margin: 4px 0 0;
  line-height: 1.45;
}

.mode-bar {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 10px 14px 4px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.mode-chip {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: var(--surface);
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
}

.mode-chip.active {
  background: var(--primary-container);
  color: var(--primary-container-fg);
  border-color: var(--primary);
}

.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 20px;
}

.empty-hero {
  max-width: 740px;
  margin: 24px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.hero-emblem {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.hero-title {
  margin: 4px 0 0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  margin: 0;
  max-width: 520px;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.memory-pill {
  border-radius: 999px;
  border: 1px solid var(--primary);
  background: var(--primary-container);
  color: var(--primary-container-fg);
  padding: 6px 14px;
  font-size: 0.84rem;
  font-weight: 600;
}

.starter-grid {
  width: 100%;
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.starter-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.starter-card:hover {
  border-color: var(--primary);
}

.starter-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.starter-prompt {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.messages-list {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg-row.user {
  align-items: flex-end;
}

.msg-row.assistant {
  align-items: flex-start;
}

.msg-bubble {
  max-width: min(88%, 680px);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  line-height: 1.55;
  font-size: 0.96rem;
  overflow-wrap: anywhere;
}

.msg-row.user .msg-bubble {
  background: var(--primary-container);
  color: var(--primary-container-fg);
  border-bottom-right-radius: 6px;
}

.msg-row.assistant .msg-bubble {
  width: 100%;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-bottom-left-radius: 6px;
}

.msg-attachment-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);
  margin-bottom: 6px;
}

.msg-thumb {
  display: block;
  max-width: 240px;
  max-height: 200px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.msg-actions {
  display: flex;
  gap: 8px;
  padding: 0 4px;
}

.msg-action-btn {
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: var(--surface);
  padding: 0 11px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.msg-action-btn:hover {
  color: var(--text);
  border-color: var(--primary);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Markdown + Code Terminal */
.md-body p {
  margin: 0 0 10px;
}

.md-body p:last-child {
  margin-bottom: 0;
}

.md-body h2,
.md-body h3,
.md-body h4,
.md-body h5 {
  margin: 12px 0 6px;
  line-height: 1.3;
}

.md-body ul,
.md-body ol {
  margin: 6px 0 10px;
  padding-left: 20px;
}

.md-body li {
  margin: 4px 0;
}

.md-body blockquote {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--primary);
  color: var(--text-muted);
}

.md-body a {
  color: var(--primary);
}

.inline-code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-high);
  padding: 2px 6px;
  border-radius: 6px;
}

.code-terminal {
  margin: 10px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #24324d;
  background: #0b1120;
  color: #e2e8f0;
}

.code-terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #162033;
  font-size: 0.78rem;
}

.code-lang {
  font-family: var(--font-mono);
  text-transform: uppercase;
  color: #94a3b8;
}

.code-copy-btn {
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.76rem;
}

.code-terminal pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Error banners */
.error-banner,
.ai-error-banner {
  max-width: 780px;
  width: calc(100% - 24px);
  margin: 0 auto 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--error-bg);
  color: var(--error);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-error-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Composer */
.composer-wrap {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 6px 12px max(12px, env(safe-area-inset-bottom));
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--outline);
  background: var(--surface);
  margin-bottom: 8px;
  max-width: 100%;
}

.attachment-thumb {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
}

.attachment-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--primary-container);
  color: var(--primary-container-fg);
}

.attachment-name {
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.listening-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: var(--secondary-container);
  color: var(--secondary-container-fg);
  font-size: 0.84rem;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
}

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--outline);
  background: var(--surface);
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tool-btn {
  min-width: 40px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 12px;
  border: none;
  background: var(--surface-high);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tool-btn.listening {
  background: var(--error-bg);
  color: var(--error);
}

.prompt-input {
  flex: 1;
  min-width: 0;
  max-height: 150px;
  border: none;
  background: transparent;
  resize: none;
  padding: 9px 4px;
  font-size: 0.96rem;
  line-height: 1.4;
  outline: none;
}

.send-btn,
.stop-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  border: none;
  background: var(--primary);
  color: var(--primary-fg);
  font-size: 1.05rem;
  font-weight: 700;
  flex-shrink: 0;
}

.send-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.stop-btn {
  background: var(--error-solid);
  color: #ffffff;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 60;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-lg {
  max-width: 580px;
}

.modal-sm {
  max-width: 400px;
}

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

.modal-header h3,
.modal-sm h3 {
  margin: 0;
  font-size: 1.12rem;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
}

.setting-title-sm {
  font-size: 0.94rem;
  font-weight: 600;
}

.segmented-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
}

.seg-btn {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--outline);
  background: var(--bg);
  font-size: 0.86rem;
  font-weight: 600;
}

.seg-btn.active {
  background: var(--primary-container);
  color: var(--primary-container-fg);
  border-color: var(--primary);
}

.card-box {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-high);
  border: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.toggle-switch {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
}

.full-width {
  width: 100%;
}

.secondary-btn,
.primary-sm-btn,
.danger-outline-btn,
.danger-solid-btn,
.text-btn,
.text-danger-btn {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
}

.secondary-btn {
  border: 1px solid var(--outline);
  background: var(--surface);
}

.primary-sm-btn {
  border: none;
  background: var(--primary);
  color: var(--primary-fg);
}

.danger-outline-btn {
  border: 1px solid var(--error);
  background: transparent;
  color: var(--error);
}

.danger-solid-btn {
  border: none;
  background: var(--error-solid);
  color: #ffffff;
}

.text-btn {
  border: none;
  background: transparent;
  color: var(--primary);
}

.text-danger-btn {
  border: none;
  background: transparent;
  color: var(--error);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Memories */
.memory-filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.filter-chip {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: var(--bg);
  font-size: 0.82rem;
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--primary-container);
  color: var(--primary-container-fg);
  border-color: var(--primary);
}

.memory-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text-input,
.select-input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--outline);
  background: var(--bg);
  padding: 10px;
  font-size: 0.9rem;
}

.editor-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.editor-row .select-input {
  width: auto;
  min-width: 140px;
}

.editor-actions {
  display: flex;
  gap: 6px;
}

.memories-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.memory-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--outline);
  background: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.memory-cat {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--secondary-container);
  color: var(--secondary-container-fg);
  margin-bottom: 6px;
}

.memory-text {
  font-size: 0.9rem;
  line-height: 1.45;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-highest);
  color: var(--text);
  border: 1px solid var(--outline);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 90;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* Mobile vs Desktop Responsive Drawer */
.mobile-only {
  display: none;
}

@media (max-width: 859px) {
  .mobile-only {
    display: grid;
  }

  .desktop-label {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(84vw, 316px);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .msg-bubble {
    max-width: 94%;
  }
}
