/* ── Palmshed Design Tokens ── */
:root {
  /* Dark theme (default) */
  --bg: #18181b;
  --surface: #27272a;
  --surface-hover: #2f2f33;
  --border: #3f3f46;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --bg-subtle: rgba(255, 255, 255, 0.04);
  --text: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #24d455;
  --accent-hover: #1fbf4a;
  --danger: #e53e3e;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono',
    'DejaVu Sans Mono', monospace;

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;

  /* Border radius */
  --radius-input: 18px;
  --radius-button: 12px;
  --radius-chip: 999px;
  --radius-card: 20px;

  /* Shadows (minimal) */
  --shadow-none: none;

  /* Misc */
  --border-header: rgba(255, 255, 255, 0.03);

  /* Icon sizing */
  --icon-sm: 14px;
  --icon-md: 16px;
  --icon-lg: 18px;
  --icon-stroke: 1.7;

  /* Animation timing */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* Light theme */
[data-theme="light"] {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-hover: #f5f5f5;
  --border: #e5e5e5;
  --border-subtle: rgba(0, 0, 0, 0.06);
  --bg-subtle: rgba(0, 0, 0, 0.04);
  --text: #171717;
  --text-secondary: #737373;
  --text-muted: #a3a3a3;
  --accent: #24d455;
  --accent-hover: #1fbf4a;
  --border-header: rgba(0, 0, 0, 0.03);
}

* {
    box-sizing: border-box;
    margin: 0;
}

::selection {
    background: var(--accent);
    color: white;
}

*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    font-weight: 400;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1 {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.025em;
    font-optical-sizing: auto;
}

h2 {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    margin: 0 0 0.75rem 0;
    color: var(--text-secondary);
    line-height: 1.4;
    letter-spacing: -0.01em;
    font-optical-sizing: auto;
}

h3 {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    margin: 2rem 0 1rem 0;
    color: var(--text);
    line-height: 1.3;
    letter-spacing: -0.015em;
    font-optical-sizing: auto;
}

h4 {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    margin: 1.5rem 0 0.5rem 0;
    color: var(--text);
    line-height: 1.4;
    font-optical-sizing: auto;
}

p {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1rem 0;
    font-weight: 400;
    font-optical-sizing: auto;
}

code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', monospace;
    font-size: 14px;
    line-height: 1.6;
    display: block;
    margin: 1rem 0;
    color: var(--text);
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-card);
    border: none;
    overflow-x: auto;
    box-shadow: none;
    white-space: pre-wrap;
    word-wrap: break-word;
}

h1:not(:first-of-type) {
    margin-top: 1.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
}

/* ── Shared Button Foundation ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-button);
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

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

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

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

/* ── Header ── */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-header);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-header-logo {
  width: 16px;
  height: 16px;
  opacity: 0.6;
  flex-shrink: 0;
}

.app-header-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  line-height: 1;
  display: none;
}

body:has(#landing[style*="display: none"]) .app-header-title,
body:has(#landing[style*="display:none"]) .app-header-title {
  display: inline;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

.app-header-btn {
  padding: 4px;
  border: none;
  color: var(--text-muted);
}

.app-header-btn:hover {
  color: var(--text-secondary);
}

.app-header-btn:active {
  transform: scale(0.92);
}

/* Theme toggle icons */
.sun-icon { display: block; }
.moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* Main content area */
.main-content {
    max-width: 42rem;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ── Landing Layout ── */

.landing {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
}

.landing-inner {
  width: 100%;
  max-width: 48rem;
  transform: translateY(-48px);
}

.landing-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
}

.landing-palm {
  width: 23px;
  height: 23px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.12));
  opacity: 0.7;
}

.landing-title {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
}

.landing-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 24px 4px;
}

.landing-composer {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.landing-composer:focus-within {
  background: var(--surface-hover);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.landing-composer .composer {
  background: transparent;
  border-radius: 0;
  border: none;
}

.landing-composer .segmented-control {
  border-top: none;
  padding: 10px 24px 12px;
}

/* ── Conversation Layout ── */

.conversation-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.conversation-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-top: 24px;
  max-width: 48rem;
  width: 100%;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.6;
}

.conversation-composer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-subtle);
  border-top: none;
  overflow: hidden;
  max-width: 48rem;
  width: 100%;
  margin: 24px auto 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.conversation-composer:focus-within {
  background: var(--surface-hover);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent);
}

.conversation-composer .composer {
  background: transparent;
  border-radius: 0;
  border: none;
}

.conversation-composer .composer-input-row {
  padding: 8px 24px;
}

.conversation-composer .segmented-control {
  border-top: none;
  padding: 6px 24px 10px;
}

/* ── Composer ── */

.composer {
  position: relative;
}

.composer-input-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 24px;
}

.composer-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.6;
  resize: none;
  min-height: 24px;
  max-height: 120px;
  overflow-y: auto;
  padding: 6px 0;
  margin: 0;
  font-weight: 400;
}

.composer-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 6px;
  flex-shrink: 0;
}

.composer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-button);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.composer-btn:hover {
  color: var(--text-secondary);
  background: var(--surface-hover);
}

.composer-btn:active {
  transform: scale(0.92);
}

.composer-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.composer-btn--send:not(.has-text) {
  display: none;
}

.composer-btn--send.has-text {
  color: var(--accent);
}

.composer-btn--send.has-text:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* ── Segmented Control ── */

.segmented-control {
  display: flex;
  gap: 2px;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border-subtle);
}

.segmented-control-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 400;
  cursor: pointer;
  border-radius: var(--radius-button);
  transition: color var(--transition-fast), background var(--transition-fast);
  font-family: var(--font);
}

.segmented-control-btn:hover {
  color: var(--text-secondary);
  background: var(--surface-hover);
}

.segmented-control-btn:active {
  transform: scale(0.96);
}

.segmented-control-btn.active {
  color: var(--accent);
  font-weight: 500;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.segmented-control-btn.active .segmented-control-icon {
  opacity: 1;
}

.segmented-control-icon {
  display: flex;
  opacity: 0.6;
}

.segmented-control-icon svg {
  width: 13px;
  height: 13px;
}

/* ── Chip ── */

.chip {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-chip);
  padding: 4px 14px;
  font-size: 0.75rem;
  font-weight: 400;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  font-family: var(--font);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.chip:hover {
  color: var(--text-secondary);
  border-color: var(--border);
  background: var(--surface-hover);
}

.chip:active {
  transform: scale(0.96);
}

/* ── Loading Dots ── */

.loading-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.loading-dots-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.loading-dots-track {
  display: flex;
  align-items: center;
}

.loading-dots-dot {
  border-radius: 50%;
  background: var(--text-muted);
  animation: loading-dot-bounce 1.4s ease-in-out infinite both;
}

@keyframes loading-dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Composer Loading ── */

.composer-loading-bar {
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  animation: composer-loading 1.5s ease-in-out infinite;
}

@keyframes composer-loading {
  0% { opacity: 0.3; width: 0; }
  50% { opacity: 1; width: 100%; }
  100% { opacity: 0.3; width: 0; }
}

.composer-loading-dots {
  display: flex;
  align-items: center;
  gap: 3px;
}

.composer-loading-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: composer-dot 1s ease-in-out infinite;
}

.composer-loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.composer-loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes composer-dot {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

/* ── Shared Button Classes ── */

.button {
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-button);
  border: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  transition: background var(--transition-fast), color var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

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

.button-primary {
  background: var(--accent);
  color: white;
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.button-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.button-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
}

.button-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.button-outline:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--text-secondary);
}

/* ── Sidebar Section Label ── */

.sidebar-section-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.sidebar-section-label:hover {
  color: var(--text);
  background: var(--surface-hover);
}

/* Cookie notification */
.cookie-notification {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--surface);
    color: var(--text-secondary);
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: none !important; /* Hidden by default */
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

.cookie-notification.show {
    display: flex; /* Show the notification */
}

.cookie-text {
    flex-grow: 1;
    margin-right: 1rem;
}

.cookie-button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.cookie-button:hover {
    background: var(--accent-hover);
}

/* Sidebar Menu */
.sidebar-menu {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border-subtle);
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-menu.open {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.close-menu {
  padding: 0.5rem;
  border-radius: 8px;
  border: none;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.close-menu:hover {
  background: var(--surface);
  color: var(--text);
}

.sidebar-content {
  padding: 1.5rem;
  flex: 1;
}

.sidebar-product-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  padding: 0 12px 16px;
  letter-spacing: -0.02em;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

#generated-image {
  display: block; /* Ensure image takes up full width */
  width: 100%;
  height: auto;
}

.image-container {
  position: relative; /* Make the image container relative for absolute positioning */
  margin-top: 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  overflow: hidden; /* Hide any overflowing content */
}

.image-actions {
  position: absolute; /* Position the actions on top of the image */
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.5rem;
  z-index: 10; /* Ensure the actions are on top of the image */
}

.image-action {
  background: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
  color: white;
  border: none;
  border-radius: var(--radius-card);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none; /* Remove underline from download link */
  font-size: 0.8rem;
}

.image-action:hover {
  background: rgba(0, 0, 0, 0.7); /* Darker background on hover */
}

.image-action svg {
  width: 12px;
  height: 12px;
  margin-right: 0.25rem;
  vertical-align: middle;
}

@media (max-width: 768px) {
  .sidebar-menu {
    width: 100vw;
    right: -100vw;
  }
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
}

.app-header-logo-btn {
  display: flex;
  gap: 8px;
  padding: 0;
  border: none;
  color: inherit;
  font: inherit;
  opacity: 0.85;
}

.app-header-logo-btn:hover {
  opacity: 1;
  background: none;
}

.app-header-logo-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
}

.dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  padding: 24px 28px;
  z-index: 1001;
  min-width: 320px;
  max-width: 400px;
}

.dialog-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
}

.dialog-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 20px;
}

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

.dialog-btn {
  padding: 8px 20px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
}

.dialog-btn--confirm {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.dialog-btn--confirm:hover {
  background: var(--accent-hover);
}

.sidebar-new-chat {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 8px;
  text-align: left;
}

.sidebar-conversation-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.sidebar-conversation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  gap: 8px;
}

.sidebar-conversation-item:hover {
  background: var(--surface-hover);
}

.sidebar-conversation-item--active {
  background: var(--surface-hover);
  outline: 1px solid var(--border);
}

.sidebar-conversation-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-conversation-title {
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-conversation-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sidebar-conversation-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.sidebar-conversation-item:hover .sidebar-conversation-actions,
.sidebar-conversation-item--active .sidebar-conversation-actions {
  opacity: 1;
}

.sidebar-action-btn {
  padding: 4px;
  border-radius: 4px;
  line-height: 0;
  color: var(--text-muted);
}

.sidebar-action-btn:hover {
  color: var(--text);
}

.sidebar-conversation-rename-input {
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.85rem;
  padding: 4px 6px;
  width: 100%;
  outline: none;
}

.sidebar-search {
  padding: 4px 12px 8px;
  position: relative;
}

.sidebar-search-input {
  width: 100%;
  padding: 6px 28px 6px 10px;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.sidebar-search-input::placeholder {
  color: var(--text-muted);
}

.sidebar-search-input:focus {
  border-color: var(--accent);
}

.sidebar-search-clear {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.sidebar-search-clear:hover {
  color: var(--text);
}

.sidebar-conversation-title mark {
  background: var(--accent);
  color: #000;
  border-radius: 2px;
  padding: 0 1px;
}

.sidebar-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 16px 12px;
  text-align: center;
}

.sidebar-error {
  font-size: 0.75rem;
  color: var(--danger, #e53e3e);
  padding: 8px 12px;
  text-align: center;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border-radius: 6px;
  margin: 4px 12px;
}

.sidebar-delete-dialog {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-dialog-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.sidebar-dialog-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 16px;
}

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

.sidebar-dialog-btn {
  padding: 6px 16px;
  font-size: 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
}

.sidebar-dialog-btn--delete {
  background: var(--danger, #e53e3e);
  color: white;
  border-color: var(--danger, #e53e3e);
}

/* ── User Messages ── */

.user-message {
  padding: 12px 16px;
  margin-bottom: 12px;
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ── Inline Message Actions (TTS) ── */

.response-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.message-tts-btn {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 4px 12px;
}

.message-tts-btn:hover {
  color: var(--text);
}

.response-actions .audio-player {
  width: 100%;
  max-width: 400px;
  height: 40px;
}

/* ── Pending Attachments ── */

.pending-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 24px 8px;
}

/* ── Attachment Chip ── */

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-chip);
  padding: 3px 10px;
  white-space: nowrap;
  cursor: default;
}

a.attachment-chip {
  text-decoration: none;
  cursor: pointer;
}

a.attachment-chip:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.attachment-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 1px;
  margin-left: 2px;
  border-radius: 4px;
  line-height: 0;
}

.attachment-chip-remove:hover {
  color: var(--text);
  background: var(--surface-hover);
}

/* ── Message Attachments ── */

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 20px 4px;
}

.attachment-image-link {
  display: inline-block;
  line-height: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  transition: opacity 0.15s;
}

.attachment-image-link:hover {
  opacity: 0.85;
}

.attachment-image {
  max-width: 240px;
  max-height: 180px;
  object-fit: cover;
  display: block;
}
