/* Compact upsell before the existing viewer/editor; previews remain chat-owned. */
.image-result-gate {
  --image-gate-preview-height: 176px;
  width: min(360px, calc(100% - 24px)); max-height: calc(100dvh - 24px);
  margin: auto; padding: 0; overflow: auto; overscroll-behavior: contain;
  color: var(--text-primary); background: var(--bg-panel);
  border: 1px solid var(--border-color); border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,.18); font-family: var(--font-family);
}
.image-result-gate, .image-result-gate * { box-sizing: border-box; }
.image-result-gate [hidden] { display: none !important; }
.image-result-gate::backdrop { background: rgba(0,0,0,.42); backdrop-filter: blur(3px); }
.image-result-gate-card { position: relative; }
.image-result-gate-close {
  position: absolute; z-index: 2; top: 5px; right: 5px; width: 44px; height: 44px;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
  background: var(--bg-panel); color: var(--text-secondary); font: 400 26px/1 var(--font-family); cursor: pointer;
}
.image-result-gate-close:hover { background: var(--bg-card); }
.image-result-gate-editor { margin: 12px 12px 0; border: 1px solid var(--border-color); border-radius: 14px; overflow: hidden; background: var(--bg-card); }
.image-result-gate-editor-header { display: flex; align-items: center; gap: 6px; min-height: 35px; padding: 10px 44px 10px 12px; background: var(--bg-panel); color: var(--text-secondary); font-size: 11px; line-height: 1.4; }
.image-result-gate-editor-header :is(i,svg) { width: 13px; height: 13px; flex-shrink: 0; color: var(--primary); }
.image-result-gate-preview { display: block; width: 100%; margin: 0; padding: 9px 8px 0; background: var(--bg-card); color: var(--text-primary); text-align: center; }
.image-result-gate-picture { display: inline-flex; position: relative; max-width: 100%; vertical-align: top; overflow: hidden; background: var(--bg-panel); box-shadow: 0 3px 10px rgba(0,0,0,.09); }
.image-result-gate-picture img { display: block; min-width: 0; width: auto; height: auto; max-width: 100%; max-height: var(--image-gate-preview-height); object-fit: contain; }
.image-result-gate-mask { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .45; touch-action: none; cursor: crosshair; }
.image-result-gate-draw-help { margin: 8px 0 2px; color: var(--text-secondary); font-size: 11px; line-height: 1.5; }
.image-result-gate-preview-status { display: flex; min-height: var(--image-gate-preview-height); align-items: center; justify-content: center; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.image-result-gate-toolbox { position: relative; }
.image-result-gate-preview-tools { display: flex; gap: 8px; padding: 8px 0 10px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.image-result-gate-preview-tools > button { display: flex; flex: 0 0 auto; justify-content: center; align-items: center; gap: 6px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--border-color); border-radius: 24px; background: var(--bg-panel); color: var(--text-secondary); font: 400 12px/1.5 var(--font-family); white-space: nowrap; cursor: pointer; }
.image-result-gate-preview-tools > button:hover, .image-result-gate-preview-tools > button[aria-pressed="true"] { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }
.image-result-gate-preview-tools :is(i,svg) { width: 14px; height: 14px; flex-shrink: 0; }
.image-result-gate-hint { position: absolute; z-index: 3; bottom: calc(100% + 4px); left: clamp(80px, var(--hint-x, 50%), calc(100% - 80px)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 12px); padding: 7px 11px; border-radius: 8px; background: var(--text-primary); color: var(--bg-panel); box-shadow: 0 3px 10px rgba(0,0,0,.15); font-size: 12px; line-height: 1.5; pointer-events: none; }
.image-result-gate-hint::after { content: ''; position: absolute; top: 100%; left: calc(50% - 4px); border: 4px solid transparent; border-top-color: var(--text-primary); }
.image-result-gate-content { padding: 20px 20px 10px; }
.image-result-gate h2 { margin: 0 0 10px; font-size: 21px; font-weight: 650; line-height: 1.2; letter-spacing: -.6px; }
.image-result-gate p { margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.image-result-gate p.image-result-gate-bonus { display: flex; align-items: center; gap: 10px; margin: 16px 0; padding: 11px 12px; border-radius: 11px; background: var(--primary-glow); color: var(--text-primary); font-size: 12px; }
.image-result-gate-bonus > span:first-child { color: var(--primary); font-size: 23px; line-height: 1; flex-shrink: 0; }
.image-result-gate-bonus strong { font-weight: 600; }
.image-result-gate .image-result-gate-cta { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin: 0; padding: 12px 13px; border-radius: 26px; font-size: 14px; line-height: 1.5; font-weight: 600; }
.image-result-gate-cta :is(i,svg) { width: 16px; height: 16px; flex-shrink: 0; }
.image-result-gate-details { margin-top: 6px; border-bottom: 1px solid var(--border-color); }
.image-result-gate-details summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 11px 0; list-style: none; color: var(--text-secondary); font-size: 12px; line-height: 1.5; cursor: pointer; }
.image-result-gate-details summary::-webkit-details-marker { display: none; }
.image-result-gate-details summary :is(i,svg) { width: 15px; height: 15px; flex-shrink: 0; }
.image-result-gate-details[open] summary :is(i,svg) { transform: rotate(180deg); }
.image-result-gate-details ul { display: grid; gap: 11px; padding: 0 0 16px; margin: 0; list-style: none; font-size: 12px; line-height: 1.5; }
.image-result-gate-details li { display: flex; align-items: flex-start; gap: 8px; }
.image-result-gate-details li :is(i,svg) { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; color: var(--primary); }
.image-result-gate :is(button,summary):focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
@media (max-width: 360px) {
  .image-result-gate-content { padding: 17px 17px 9px; }
  .image-result-gate p { font-size: 12px; }
}
@media (max-height: 650px) {
  .image-result-gate { --image-gate-preview-height: 104px; }
  .image-result-gate-content { padding-top: 14px; }
  .image-result-gate p.image-result-gate-bonus { margin: 12px 0; }
}
@media (max-width: 600px) {
  .image-result-gate { --image-gate-preview-height: clamp(140px, 36dvh, 360px); position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .image-result-gate-card { display: flex; flex-direction: column; min-height: 100%; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
  .image-result-gate-editor { margin: 0; border-width: 0 0 1px; border-radius: 0; }
  .image-result-gate-editor-header { min-height: 52px; padding-left: 20px; font-size: 13px; }
  .image-result-gate-close { top: calc(4px + env(safe-area-inset-top, 0px)); right: calc(4px + env(safe-area-inset-right, 0px)); }
  .image-result-gate-preview { padding: 12px 16px 0; }
  .image-result-gate-content { width: 100%; max-width: 480px; margin: auto; padding: 22px 20px 12px; }
}
@media (min-width: 768px) {
  .image-result-gate { --image-gate-preview-height: clamp(140px, calc(100dvh - 240px), 380px); width: min(900px, calc(100% - 48px)); }
  .image-result-gate-card { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .image-result-gate-editor { display: flex; flex-direction: column; min-width: 0; margin: 16px 0 16px 16px; }
  .image-result-gate-editor-header { padding: 12px 16px; font-size: 12px; }
  .image-result-gate-preview { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; padding: 16px 12px 0; }
  .image-result-gate-toolbox { width: 100%; }
  .image-result-gate-content { align-self: center; min-width: 0; padding: 48px 32px; }
  .image-result-gate-close { top: 10px; right: 10px; }
}

/* Design Tokens & Theme Variables matching study24.ai */
:root {
  /* Colors */
  --bg-main: #ffffff;
  --bg-sidebar: #f5f5f7;
  --bg-panel: #ffffff;
  --bg-card: #f9f9fb;
  --bg-input: #ffffff;
  
  --border-color: rgba(13, 13, 13, 0.08);
  --border-focus: #0a7cff;
  
  --text-primary: #0d0d0d;
  --text-secondary: rgba(13, 13, 13, 0.6);
  --text-muted: rgba(13, 13, 13, 0.35);
  
  --primary: #0a7cff;
  --primary-glow: rgba(10, 124, 255, 0.15);
  --primary-hover: #006ce6;
  --accent: #00c853;
  
  --success: #00c853;
  --danger: #ef4444;
  --warning: #f59e0b;

  --job-card-bg: rgba(255, 255, 255, 0.45);
  --job-card-border: rgba(15, 23, 42, 0.06);
  --job-card-bg-hover: rgba(255, 255, 255, 0.9);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  
  --transition-fast: 0.15s ease-out;
  --transition-normal: 0.25s ease-out;
}

body.dark-theme {
  --bg-main: #0d0d0d;
  --bg-sidebar: #171717;
  --bg-panel: #171717;
  --bg-card: #212121;
  --bg-input: #212121;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #0a7cff;
  
  --text-primary: #f5f5f7;
  --text-secondary: rgba(245, 245, 247, 0.6);
  --text-muted: rgba(245, 245, 247, 0.35);
  
  --primary-glow: rgba(10, 124, 255, 0.25);

  --job-card-bg: rgba(255, 255, 255, 0.05);
  --job-card-border: rgba(255, 255, 255, 0.08);
  --job-card-bg-hover: rgba(255, 255, 255, 0.12);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.glass-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
}

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.15);
}

/* Buttons */
button {
  font-family: var(--font-family);
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: inherit;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 0.9rem;
}

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

.secondary-btn {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-weight: 500;
}

.secondary-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

.ghost-btn {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-md);
}

.ghost-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
}

.icon-btn-text {
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 14px;
  width: 100%;
  justify-content: flex-start;
}

.icon-btn-text:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.text-danger {
  color: var(--danger) !important;
}

.text-danger:hover {
  background: rgba(239, 68, 68, 0.05) !important;
}

/* Auth Screens */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  background-color: var(--bg-sidebar);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 30px;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  animation: fadeIn var(--transition-normal);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.logo-icon {
  font-size: 2rem;
  color: var(--primary);
}

.logo h1, .logo h2 {
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.input-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.input-group input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px;
  border-radius: var(--radius-md);
  outline: none;
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

#auth-submit-btn {
  width: 100%;
  margin-top: 10px;
  background: var(--primary);
  border-radius: var(--radius-pill);
  padding: 12px;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* App Layout */
.main-wrapper {
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

/* Sidebar styling exactly matching study24.ai */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 10;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-sidebar);
  z-index: 10;
  position: relative;
  flex-shrink: 0;
}

.sidebar-header .logo {
  justify-content: flex-start;
}

.sidebar-header h2 {
  font-size: 1.3rem;
}

#new-chat-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}

#new-chat-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
}

/* Chat List */
.chat-list {
  flex: none;
  height: auto;
  overflow: visible;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
}

/* Hover only where there is a mouse (2026-11-13): on iPhone a hover that reveals
   the delete button turned the first tap into a «hover», so a chat in the side
   menu opened only on the second tap. */
@media (hover: hover) and (pointer: fine) {
  .chat-item:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
  }

  .chat-item:hover .delete-chat-btn {
    opacity: 1;
  }
}

.chat-item.active {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
  font-weight: 500;
}

.chat-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  flex: 1;
}

.chat-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85rem;
}

.delete-chat-btn {
  background: transparent;
  color: var(--text-muted);
  opacity: 0;
  padding: 2px;
  border-radius: var(--radius-sm);
}

/* No hover on a touch screen: the delete button stays visible, but quiet. */
@media (hover: none), (pointer: coarse) {
  .delete-chat-btn {
    opacity: 0.55;
  }
}

.delete-chat-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

/* Sidebar Footer Profile Card */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  background: var(--bg-sidebar);
  z-index: 10;
  position: relative;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #0a7cff;
  color: #fff;
  padding: 8px;
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.user-email {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-tier {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 1px;
}

.balance-display {
  display: none; /* In study24.ai, balance is in the header, not footer */
}

/* Chat Area - Light theme */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
  position: relative;
  background-color: var(--bg-main);
}

.chat-header {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: var(--bg-main);
}

.model-info {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  background: var(--bg-panel);
}

.model-info:hover {
  background: var(--bg-card);
}

.model-icon {
  width: 16px;
  height: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.model-icon svg, 
.welcome-model-icon svg,
.message-avatar svg,
.dropdown-icon svg,
.net-card-icon svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}



.welcome-model-icon svg,
.model-icon svg,
.dropdown-icon svg,
.net-card-icon svg {
  color: currentColor;
}

.model-info h3 {
  font-size: 0.85rem;
  font-weight: 500;
}

.status-indicator {
  display: none; /* Hide in header */
}

/* Header balance and pricing button */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 124, 255, 0.08);
  border-radius: var(--radius-pill);
  padding: 0 14px;
  height: 32px;
  box-sizing: border-box;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
  position: relative;
  cursor: pointer;
}

.header-balance-icon {
  color: var(--primary);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.header-balance-icon-star {
  color: var(--primary);
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

/* Micro progress bar for the header badge */
.micro-progress-bar {
  width: 36px;
  height: 6px;
  background: rgba(10, 124, 255, 0.2);
  border-radius: var(--radius-pill);
  overflow: hidden;
  display: flex;
  flex-shrink: 0;
}

.micro-progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

/* Base state: hidden popover */
.balance-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, pointer-events 0.2s ease;
  transition-delay: 1.2s; /* 1.2 seconds delay to allow clicking on child elements before closing */
  z-index: 999;
  box-sizing: border-box;
}

body.dark-theme .balance-popover {
  background: rgba(33, 33, 33, 0.95);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Transparent bridge to prevent losing hover when crossing the gap */
.balance-popover::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 0;
  width: 100%;
  height: 12px;
  background: transparent;
}

/* Hover trigger */
.header-balance:hover .balance-popover {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  transition-delay: 0s; /* Show immediately on hover */
}

/* A window closed by a tap leaves the tap point "hovered" (see suppressStickyHover). */
body.suppress-sticky-hover .header-balance:hover .balance-popover {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition-delay: 0s;
}

/* Popover Content Styling */
.popover-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
}

.popover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.popover-block-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.popover-tokens-detail {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
}

.popover-balance-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

/* Progress bars inside popover */
.popover-progress-bg {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

body.dark-theme .popover-progress-bg {
  background: rgba(255, 255, 255, 0.1);
}

.popover-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

.popover-divider {
  height: 1px;
  background: var(--border-color);
  width: 100%;
}

/* Dashed tariff connector block inside popover */
.popover-subscription-dashed {
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  background: rgba(0, 0, 0, 0.01);
  box-sizing: border-box;
}

body.dark-theme .popover-subscription-dashed {
  background: rgba(255, 255, 255, 0.01);
}

.dashed-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Token packages inside the balance block */
.token-packages {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.token-packages:empty {
  display: none;
}

.token-packages-note {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Profile: package cards under the balance; swipe sideways on phones */
.profile-token-packages:empty,
.profile-token-packages .token-packages:empty {
  display: none;
}

.profile-token-packages {
  width: 100%;
  margin-top: 16px;
}

.profile-token-packages .token-packages {
  gap: 10px;
}

.profile-token-packages .token-packages-note {
  font-size: 0.85rem;
}

.token-package-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 10px; /* room for the ribbon */
}

.token-package-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-sizing: border-box;
  min-width: 0;
}

.token-package-card.is-best {
  border-color: var(--primary);
  background: linear-gradient(180deg, rgba(10, 124, 255, 0.08), rgba(10, 124, 255, 0.02));
  box-shadow: 0 6px 20px var(--primary-glow);
}

.token-package-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 22px;
  margin-bottom: 10px;
}

.token-package-badge {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 5px 8px;
  border-radius: var(--radius-pill);
  background: rgba(0, 200, 83, 0.12);
  color: #00873a;
}

/* Sits on the top border, so it never pushes the card content down. */
.token-package-ribbon {
  position: absolute;
  top: 0;
  left: 16px;
  transform: translateY(-50%);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  white-space: nowrap;
}

body.dark-theme .token-package-badge {
  color: #4ade80;
}

.token-package-price {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
  white-space: nowrap;
  margin-bottom: 8px;
}

.token-package-amount {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  margin-bottom: 14px;
}

.token-package-star {
  color: var(--primary);
}

.token-package-usage {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding-top: 12px;
  margin-bottom: 14px;
  border-top: 1px solid var(--border-color);
}

.token-package-usage-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.token-package-usage-item {
  position: relative;
  padding-left: 22px;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.token-package-usage-item::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.token-package-usage-or {
  padding-left: 22px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.token-package-buy {
  margin-top: auto;
  width: 100%;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(10, 124, 255, 0.1);
  color: var(--primary);
  transition: background var(--transition-fast), opacity var(--transition-fast);
}

.token-package-buy:hover {
  background: rgba(10, 124, 255, 0.16);
}

.token-package-card.is-best .token-package-buy {
  background: var(--primary);
  color: #fff;
}

.token-package-card.is-best .token-package-buy:hover {
  background: var(--primary-hover);
}

.token-package-buy:disabled {
  opacity: 0.6;
  cursor: progress;
}

@media (max-width: 600px) {
  .token-package-list {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* The next card peeks in to hint that the row scrolls. */
    padding: 10px 0 8px;
  }

  .token-package-list::-webkit-scrollbar {
    display: none;
  }

  .token-package-card {
    flex: 0 0 72%;
    scroll-snap-align: start;
  }
}

/* /token window; the id outranks the shared .lightbox-content rules further down. */
#token-packages-modal .token-modal-content {
  max-width: 920px;
  padding: 28px;
  gap: 20px;
  box-sizing: border-box;
}

.token-modal-header h3 {
  margin: 0 40px 6px 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}

.token-modal-subtitle {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.token-modal-limit {
  margin: 0 40px 12px 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.12);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
}

.token-modal-limit.hidden {
  display: none;
}

.token-modal-balance {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(10, 124, 255, 0.08);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
}

/* The window already says the tokens never expire. */
.token-modal-packages > .token-packages > .token-packages-note:first-child:not(:only-child) {
  display: none;
}

.token-modal-tariff-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
}

.token-modal-tariff-hint.hidden {
  display: none;
}

.token-modal-tariff-badge {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff9500, #ff5e3a);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 6px 16px rgba(255, 94, 58, 0.3);
}

.token-modal-tariff-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.token-modal-tariff-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.token-modal-tariff-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.small-pale-btn.token-modal-tariff-btn {
  flex-shrink: 0;
  align-self: center;
  min-height: 44px;
  padding: 12px 20px;
  font-size: 0.875rem;
  white-space: nowrap;
}

@media (max-width: 600px) {
  /* Full screen on phones: more room for the cards. */
  #token-packages-modal {
    padding: 0;
  }

  /* The id outranks the shared .lightbox-content rules further down. */
  #token-packages-modal .token-modal-content {
    max-width: none;
    height: 100%;
    max-height: 100dvh;
    border: none;
    border-radius: 0;
    padding: calc(22px + env(safe-area-inset-top)) 18px calc(22px + env(safe-area-inset-bottom));
  }

  .token-modal-content .lightbox-close-btn {
    top: calc(14px + env(safe-area-inset-top));
  }

  /* Badge and text in one row, the button below them. */
  .token-modal-tariff-hint {
    flex-wrap: wrap;
    gap: 12px;
  }

  .token-modal-tariff-badge {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .token-modal-tariff-text {
    flex-basis: calc(100% - 52px);
  }

  .token-modal-tariff-btn {
    flex-basis: 100%;
  }
}

/* Choose tariff button inside popover (small & pale) */
.small-pale-btn {
  background: rgba(10, 124, 255, 0.08);
  color: var(--primary);
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), opacity var(--transition-fast);
  align-self: flex-start;
  opacity: 0.85;
}

.small-pale-btn:hover {
  background: rgba(10, 124, 255, 0.12);
  opacity: 1;
}

.choose-tariff-btn {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 0 16px;
  height: 32px;
  box-sizing: border-box;
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

/* Chat History */
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Welcome Center Screen */
.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 800px;
  margin: auto;
  gap: 12px;
  color: var(--text-secondary);
  box-sizing: border-box;
}

/* Welcome screen jobs grid and cards (Compact Wrapped Grid Layout) */
.welcome-jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 800px;
  margin-top: 20px;
  padding: 0 16px;
  box-sizing: border-box;
  justify-content: center;
}

.welcome-jobs-grid.grid-4-cols {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
  .welcome-jobs-grid.grid-4-cols {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .welcome-jobs-grid.grid-4-cols {
    grid-template-columns: repeat(2, 1fr);
  }
}

.job-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  background: var(--job-card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--job-card-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  min-width: 0;
  box-sizing: border-box;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.005);
}

.job-card:hover {
  transform: translateY(-3px);
  background: var(--job-card-bg-hover);
  box-shadow: 0 6px 18px var(--hover-shadow);
  border-color: var(--hover-border);
}

/* Custom themed glows for hover states */
.job-card:nth-child(1) {
  --hover-border: rgba(10, 124, 255, 0.3);
  --hover-shadow: rgba(10, 124, 255, 0.05);
}
.job-card:nth-child(2) {
  --hover-border: rgba(6, 182, 212, 0.3);
  --hover-shadow: rgba(6, 182, 212, 0.05);
}
.job-card:nth-child(3) {
  --hover-border: rgba(139, 92, 246, 0.3);
  --hover-shadow: rgba(139, 92, 246, 0.05);
}
.job-card:nth-child(4) {
  --hover-border: rgba(245, 158, 11, 0.3);
  --hover-shadow: rgba(245, 158, 11, 0.05);
}
.job-card:nth-child(5) {
  --hover-border: rgba(16, 185, 129, 0.3);
  --hover-shadow: rgba(16, 185, 129, 0.05);
}
.job-card:nth-child(6) {
  --hover-border: rgba(244, 63, 94, 0.3);
  --hover-shadow: rgba(244, 63, 94, 0.05);
}
.job-card:nth-child(7) {
  --hover-border: rgba(79, 70, 229, 0.3);
  --hover-shadow: rgba(79, 70, 229, 0.05);
}
.job-card:nth-child(8) {
  --hover-border: rgba(13, 148, 136, 0.3);
  --hover-shadow: rgba(13, 148, 136, 0.05);
}
.job-card:nth-child(9) {
  --hover-border: rgba(217, 70, 239, 0.3);
  --hover-shadow: rgba(217, 70, 239, 0.05);
}
.job-card:nth-child(10) {
  --hover-border: rgba(234, 88, 12, 0.3);
  --hover-shadow: rgba(234, 88, 12, 0.05);
}

.job-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}

.job-card:nth-child(10n + 1) .job-icon {
  background: rgba(10, 124, 255, 0.08);
  color: #0a7cff;
}
.job-card:nth-child(10n + 2) .job-icon {
  background: rgba(6, 182, 212, 0.08);
  color: #06b6d4;
}
.job-card:nth-child(10n + 3) .job-icon {
  background: rgba(139, 92, 246, 0.08);
  color: #8b5cf6;
}
.job-card:nth-child(10n + 4) .job-icon {
  background: rgba(245, 158, 11, 0.08);
  color: #f59e0b;
}
.job-card:nth-child(10n + 5) .job-icon {
  background: rgba(16, 185, 129, 0.08);
  color: #10b981;
}
.job-card:nth-child(10n + 6) .job-icon {
  background: rgba(244, 63, 94, 0.08);
  color: #f43f5e;
}
.job-card:nth-child(10n + 7) .job-icon {
  background: rgba(79, 70, 229, 0.08);
  color: #4f46e5;
}
.job-card:nth-child(10n + 8) .job-icon {
  background: rgba(13, 148, 136, 0.08);
  color: #0d9488;
}
.job-card:nth-child(10n + 9) .job-icon {
  background: rgba(217, 70, 239, 0.08);
  color: #d946ef;
}
.job-card:nth-child(10n + 10) .job-icon {
  background: rgba(234, 88, 12, 0.08);
  color: #ea580c;
}

.job-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-width: 0;
}

.job-info h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.job-card .job-info p {
  font-size: 0.68rem;
  color: var(--text-secondary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  width: 100%;
  height: 2.6em;
}


.welcome-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-glow);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.welcome-screen h1, .welcome-screen .welcome-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 2.2rem;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.welcome-screen > p {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.gradient-text {
  background: linear-gradient(90deg, #ff0000 0%, #9900ff 50%, #0000ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

/* Messages styling matching study24.ai */
.message-bubble {
  display: flex;
  gap: 12px;
  max-width: 760px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.message-bubble.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

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

/* Chat answers stay compact; the full picture opens in the viewer/editor.
   Limits are absolute: a percentage here lets the answer frame keep the
   picture's natural width (e.g. 1536px) while the picture itself shrinks. */
.generated-image-output {
  display: block;
  width: auto;
  height: auto;
  max-width: 360px;
  max-height: 420px;
  object-fit: contain;
  border-radius: 8px;
}

.generated-image-output.opens-editor {
  cursor: zoom-in;
}

@media (max-width: 768px) {
  .generated-image-output {
    max-width: 75vw;
    max-height: 55vh;
  }
}

.msg-avatar {
  display: none; /* Hide avatars in message list to match modern simple screenshot design */
}

.msg-content {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  line-height: 1.5;
  font-size: 0.92rem;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.msg-content h1,
.msg-content h2,
.msg-content h3,
.msg-content h4,
.msg-content h5,
.msg-content h6 {
  margin-top: 14px;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.msg-content h1 { font-size: 1.35rem; }
.msg-content h2 { font-size: 1.2rem; }
.msg-content h3 { font-size: 1.1rem; }
.msg-content h4 { font-size: 1.0rem; }
.msg-content h5 { font-size: 0.95rem; }
.msg-content h6 { font-size: 0.9rem; }

.msg-content h1:first-child,
.msg-content h2:first-child,
.msg-content h3:first-child,
.msg-content h4:first-child,
.msg-content h5:first-child,
.msg-content h6:first-child {
  margin-top: 0;
}

.message-bubble.user .msg-content {
  max-width: 75%;
  background: var(--bg-sidebar);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
}

.message-bubble.assistant .msg-content {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.msg-content code {
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85em;
  color: #c2185b;
}

.msg-content pre {
  background: #f9f9fb;
  padding: 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 10px 0;
  border: 1px solid var(--border-color);
}

.msg-content pre code {
  background: transparent;
  padding: 0;
  color: #0d0d0d;
}

/* Input area matching screenshots */
.chat-input-area {
  padding: 16px 24px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 760px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  transition: all 0.3s ease-in-out;
  flex-shrink: 0;
}

.chat-composer-notice-slot.hidden { display: none; }
.chat-composer-notice {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 104px;
  padding: 14px 62px 14px 20px;
  border: 1px solid rgba(245, 158, 11, .30);
  border-radius: 18px;
  background: linear-gradient(112deg, rgba(255, 250, 229, .98) 0%, rgba(255, 255, 255, .98) 58%, rgba(255, 247, 218, .96) 100%);
  box-shadow: 0 10px 28px rgba(180, 113, 13, .10), inset 0 1px 0 rgba(255, 255, 255, .9);
  color: var(--text-primary);
}
.chat-composer-notice::before {
  content: ''; position: absolute; width: 120px; height: 120px; right: -64px; top: -82px;
  border-radius: 50%; background: rgba(245, 158, 11, .13); filter: blur(2px); pointer-events: none;
}
.chat-composer-notice__icon {
  width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 38px;
  border-radius: 13px; background: linear-gradient(135deg, #1688ff, #0a6ded);
  color: #fff; font-size: 19px; font-weight: 700; box-shadow: 0 6px 15px rgba(10, 124, 255, .28);
}
.chat-composer-notice__copy { position: relative; z-index: 1; display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.chat-composer-notice__copy strong { font-size: .93rem; letter-spacing: -.01em; }
.chat-composer-notice__copy span { color: var(--text-secondary); font-size: .82rem; line-height: 1.4; }
.chat-composer-notice__actions { position: static; z-index: 1; display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-right: 4px; }
.chat-composer-notice__primary {
  border: 0; border-radius: var(--radius-pill); padding: 10px 16px;
  background: var(--primary); color: #fff; font: inherit; font-size: .84rem;
  font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background var(--transition-fast);
}
.chat-composer-notice__primary:hover { background: var(--primary-hover); }
.chat-composer-notice__close {
  position: absolute; top: 11px; right: 11px;
  width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(10, 124, 255, .07); color: var(--text-secondary);
  font-size: 20px; line-height: 1; cursor: pointer;
}
body.dark-theme .chat-composer-notice { background: linear-gradient(112deg, rgba(67, 48, 11, .98), rgba(44, 34, 14, .98)); border-color: rgba(245, 158, 11, .34); box-shadow: 0 10px 28px rgba(0, 0, 0, .24); }
body.dark-theme .chat-composer-notice__close { background: rgba(245, 180, 60, .14); }

#chat-screen.welcome-mode {
  overflow-y: auto;
}

#chat-screen.welcome-mode .chat-history {
  flex: none;
  padding-bottom: 0;
  margin-top: 10vh; /* Сдвиг сверху, чтобы заголовок был не в самом верху, но и не по центру */
}

#chat-screen.welcome-mode .chat-input-area {
  flex: none;
  margin-bottom: 24px;
}

/* Стили для скроллящегося списка моделей под инпутом на главной */
.welcome-models-container {
  margin-top: 16px;
  width: 100%;
}

.welcome-legal .nutri-legal { margin-top: 12px; padding-bottom: 4px; }

.welcome-models-scroll {
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}

.welcome-models-scroll::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

.welcome-tabs-container {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  margin-bottom: 12px;
}

.welcome-tabs-bg {
  display: inline-flex;
  background: var(--bg-panel);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
}

.welcome-tab-btn {
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.welcome-tab-btn:hover {
  background: rgba(0,0,0,0.03);
  color: var(--text-primary);
}

body.dark-theme .welcome-tab-btn:hover {
  background: rgba(255,255,255,0.03);
}

.welcome-tab-btn.active {
  background: rgba(10, 124, 255, 0.08);
  color: var(--primary);
  font-weight: 600;
}

.welcome-jobs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 4px;
}

@media (max-width: 768px) {
  .welcome-tab-btn { padding: 6px 10px; font-size: .8rem; white-space: nowrap; }
}

@media (max-width: 768px) {
  .welcome-jobs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.welcome-models-grid {
  display: flex;
  gap: 8px;
  padding: 4px;
  justify-content: center; /* Центрируем, если элементов мало */
  min-width: min-content;
}

.welcome-model-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  width: 90px;
  height: 84px;
  padding: 8px;
  box-sizing: border-box;
  border-radius: var(--radius-md);
  background: var(--job-card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--job-card-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.005);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  color: var(--text-secondary);
}

.welcome-model-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.2s ease;
  filter: grayscale(100%);
}

.welcome-model-card[data-photo-tool-path] {
  height: 90px;
  font-family: inherit;
}

.welcome-model-card.active .welcome-model-icon {
  filter: grayscale(0%);
}

.welcome-model-card:hover {
  transform: translateY(-3px);
  background: var(--job-card-bg-hover);
  box-shadow: 0 6px 18px rgba(10, 124, 255, 0.15);
  border-color: rgba(10, 124, 255, 0.3);
  color: var(--text-primary);
}

body.dark-theme .welcome-model-card:hover {
  background: rgba(255,255,255,0.02);
}

.welcome-model-card.active {
  background: var(--job-card-bg);
  border-color: rgba(10, 124, 255, 0.3);
  color: var(--primary);
  font-weight: 600;
}

.welcome-model-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-model-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}



.welcome-model-name {
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.welcome-model-card.active .welcome-model-name {
  font-weight: 600;
}

/* Инлайн-кнопки (Формат, Длительность) внутри инпута */
.image-opt-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 0 12px;
  height: 34px;
  box-sizing: border-box;
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.image-opt-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-muted);
}


.input-container {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.input-container textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.95rem;
  line-height: 1.4;
  max-height: 400px;
  padding-right: 12px;
}

/* Give the composer an extra line of comfortable writing/click space. */
#message-input {
  min-height: 2.8em;
}

#message-input::placeholder {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.4;
  opacity: 1;
}

.send-btn {
  background: var(--primary);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.send-btn:disabled {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-muted);
  cursor: not-allowed;
}

.stop-btn {
  background: var(--danger);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.stop-btn:hover {
  background: #dc2626;
  transform: scale(1.05);
}

/* Blockquote */
.msg-content blockquote {
  border-left: 3px solid var(--primary);
  padding: 8px 12px;
  margin: 10px 0;
  color: var(--text-secondary);
  font-style: italic;
  background: rgba(10, 124, 255, 0.03);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

body.dark-theme .msg-content blockquote {
  background: rgba(10, 124, 255, 0.06);
}

/* Tables inside chat bubbles */
.table-container {
  width: 100%;
  overflow-x: auto;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  -webkit-overflow-scrolling: touch;
}

.msg-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.msg-content th {
  background: var(--bg-sidebar);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
  min-width: 120px;
}

body.dark-theme .msg-content th {
  background: var(--bg-sidebar);
}

.msg-content td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  min-width: 120px;
  word-break: break-word;
}

.msg-content tr:last-child td {
  border-bottom: none;
}

/* Table Caption / Signature styling with subtle color and minimal appearance */
.table-caption {
  font-size: 0.82rem;
  font-weight: 600;
  font-style: italic;
  color: var(--text-secondary);
  padding: 4px 0;
  margin: 6px 0;
  display: block;
  box-sizing: border-box;
}

.table-caption.above {
  margin-bottom: 6px;
}

.table-caption.below {
  margin-top: 6px;
}

/* Code block wrapper and header */
.code-block-wrapper {
  margin: 12px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #f9f9fb;
}

body.dark-theme .code-block-wrapper {
  background: #1e1e1e;
}

.code-block-header {
  background: rgba(0, 0, 0, 0.03);
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

body.dark-theme .code-block-header {
  background: rgba(255, 255, 255, 0.03);
}

.code-block-wrapper pre {
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
}

/* Msg Actions & Copy/Feedback Buttons */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid rgba(0, 0, 0, 0.03);
}

body.dark-theme .msg-actions {
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.msg-action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.msg-action-btn i, .msg-action-btn svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 768px) {
  .msg-action-btn {
    padding: 8px;
  }
  .msg-action-btn i, .msg-action-btn svg {
    width: 20px;
    height: 20px;
  }
}

.msg-action-btn:hover {
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.04);
}

body.dark-theme .msg-action-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

.msg-action-btn.active {
  color: var(--primary);
}

.msg-action-btn.copied {
  color: var(--success);
}

/* Suggestion Pills for continuation of dialogue */
.msg-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.03);
}

body.dark-theme .msg-suggestions {
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.suggestion-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.suggestion-pill:hover {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.suggestion-pill:active {
  transform: translateY(0);
}

.input-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

/* Pricing Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 900px;
  border-radius: var(--radius-lg);
  padding: 30px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  position: relative;
}

.modal-header h2 {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.modal-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.close-modal-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.8rem;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-modal-btn:hover {
  color: var(--text-primary);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color var(--transition-fast);
}

.pricing-card:hover {
  border-color: rgba(10, 124, 255, 0.4);
}

.pricing-card.popular {
  border-color: var(--primary);
  background: rgba(10, 124, 255, 0.01);
}

.card-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.04);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-weight: 600;
}

.popular-badge {
  background: var(--primary);
  color: #fff;
}

.discount-badge {
  background: var(--success);
  color: #fff;
}

.pricing-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.price span {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.old-price {
  font-size: 1rem;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-left: 6px;
  font-weight: 400;
}

.tokens-badge {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  background: rgba(10, 124, 255, 0.08);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  display: inline-block;
  align-self: flex-start;
  margin-bottom: 20px;
}

.features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  flex: 1;
}

.features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.features li i {
  color: var(--success);
  width: 14px;
  height: 14px;
}

.pricing-btn {
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.88rem;
  width: 100%;
}

.pricing-btn:hover {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.15);
}

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

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

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sidebar and Header Mobile Base Styles */
.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.close-sidebar-btn {
  display: none !important;
}

.sidebar-menu-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 20px;
}

.sidebar-menu-items .icon-btn-text {
  padding: 10px 14px;
  margin: 3px 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-menu-items .icon-btn-text.active:not(#chat-history-accordion-btn) {
  background: rgba(10, 124, 255, 0.08);
  color: var(--primary);
}

#chat-history-accordion-btn.active #chat-history-chevron {
  transform: rotate(180deg);
}

.sidebar-menu-items .icon-btn-text.active:not(#chat-history-accordion-btn):hover {
  background: rgba(10, 124, 255, 0.12);
}

body.dark-theme .sidebar-menu-items .icon-btn-text.active:not(#chat-history-accordion-btn) {
  background: rgba(10, 124, 255, 0.15);
  color: #3b9cff;
}

body.dark-theme .sidebar-menu-items .icon-btn-text.active:not(#chat-history-accordion-btn):hover {
  background: rgba(10, 124, 255, 0.2);
}

.sidebar-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 24px 4px 24px;
  letter-spacing: 0.5px;
}

.sidebar-tariff-btn {
  display: none !important;
}

.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 13, 13, 0.4);
  backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.mobile-menu-toggle {
  display: none !important;
}

/* Profile Dropdown Menu & Theme Switcher Styles */
.profile-container {
  position: relative;
  width: auto;
  margin: 0 -16px -16px -16px;
  padding: 16px 20px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.profile-container:hover {
  background: rgba(0, 0, 0, 0.03);
}

body.dark-theme .profile-container:hover {
  background: rgba(255, 255, 255, 0.05);
}

.profile-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 4px;
  right: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 110;
  animation: fadeInFast 0.15s ease-out;
}

@keyframes fadeInFast {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  width: 100%;
  text-align: left;
  transition: background var(--transition-fast);
  background: transparent;
  border: none;
  cursor: pointer;
}

.dropdown-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

body.dark-theme .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.dropdown-item i {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.dropdown-item.text-danger {
  color: var(--danger) !important;
}

.dropdown-item.text-danger i {
  color: var(--danger) !important;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 4px;
}

/* Theme Switcher Pill Container */
.theme-switcher {
  display: flex;
  background: var(--bg-sidebar);
  border-radius: var(--radius-pill);
  padding: 4px;
  margin: 4px 6px;
  justify-content: space-between;
  border: 1px solid var(--border-color);
}

.theme-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  background: transparent;
  border: none;
  cursor: pointer;
}

.theme-btn:hover {
  color: var(--text-primary);
}

.theme-btn.active {
  background: var(--bg-panel);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Profile Screen Styles */
.profile-scroll-container {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-main);
  padding: 24px;
}

.profile-content-wrapper {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-cards-grid {
  display: grid;
  /* minmax(0, …): a sideways-scrolling row inside a card must not widen the column. */
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .profile-cards-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.profile-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.02);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.dark-theme .profile-card {
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.user-card {
  position: relative;
  overflow: hidden;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(10, 124, 255, 0.07) 0%, rgba(91, 75, 255, 0.05) 100%);
  border: 1px solid rgba(10, 124, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 32px 28px;
}

body.dark-theme .user-card {
  background: linear-gradient(135deg, rgba(10, 124, 255, 0.12) 0%, rgba(91, 75, 255, 0.08) 100%);
  border-color: rgba(10, 124, 255, 0.25);
}

.user-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.profile-avatar-wrapper {
  width: 56px;
  height: 56px;
  background: rgba(10, 124, 255, 0.1);
  border: 1px solid rgba(10, 124, 255, 0.2);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
  color: var(--primary);
}

body.dark-theme .profile-avatar-wrapper {
  background: rgba(10, 124, 255, 0.18);
  border-color: rgba(10, 124, 255, 0.3);
}

.user-meta h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.user-meta p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.profile-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #ef4444;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  z-index: 1;
}

.profile-logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.25);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.profile-marketing-consent {
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: rgba(10, 124, 255, 0.035);
  font-size: 0.8rem;
  line-height: 1.5;
}

.profile-marketing-consent h4 {
  margin: 0 0 4px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
}

.profile-marketing-consent p { margin: 0; }
.profile-marketing-consent a { color: var(--primary); text-underline-offset: 2px; }
.profile-marketing-choice { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; cursor: pointer; }
.profile-marketing-choice input { flex: 0 0 15px; width: 15px; height: 15px; margin: 3px 0 0; accent-color: var(--primary); cursor: pointer; }
.profile-marketing-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.profile-marketing-actions span { color: var(--text-muted); font-size: 0.75rem; }
.profile-marketing-actions button {
  padding: 7px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.profile-marketing-actions button:disabled { opacity: 0.45; cursor: default; }
#profile-marketing-error { margin-top: 8px; color: var(--danger); }

.profile-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.profile-card-icon-wrapper {
  width: 36px;
  height: 36px;
  background: rgba(10, 124, 255, 0.08);
  border: 1px solid rgba(10, 124, 255, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

body.dark-theme .profile-card-icon-wrapper {
  background: rgba(10, 124, 255, 0.15);
  border-color: rgba(10, 124, 255, 0.25);
  color: #3b9cff;
}

.tariff-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.tariff-badge-container {
  display: flex;
  align-items: center;
  gap: 20px;
}

.tariff-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.profile-tokens-count {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 124, 255, 0.08);
  color: var(--primary);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.95rem;
}

.profile-tokens-count.inactive-badge {
  font-size: 0.8rem;
  padding: 4px 12px;
  font-weight: 500;
  background: rgba(10, 124, 255, 0.06);
}

.profile-tokens-count.inactive-badge span:first-child {
  font-size: 0.9rem !important;
}

.continue-activation-btn {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  transition: background var(--transition-fast);
}

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

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

.promocode-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 400px;
}

.promocode-input-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.promocode-input-group input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  outline: none;
  font-size: 0.9rem;
  width: 240px;
  color: var(--text-primary);
}

.promocode-input-group input:focus {
  border-color: var(--primary);
}

.promocode-input-group button {
  background: var(--text-primary);
  color: var(--bg-panel);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.9rem;
}

.promocode-input-group button:hover {
  opacity: 0.9;
}

#copy-referral-btn {
  background: var(--primary);
  color: #fff;
}

#copy-referral-btn:hover {
  background: var(--primary-hover);
  opacity: 1;
}

#referral-modal-copy-btn:hover {
  background: var(--primary-hover) !important;
}

.signin-methods-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.social-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  object-fit: cover;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--primary);
}
input:checked + .slider:before {
  -webkit-transform: translateX(20px);
  -ms-transform: translateX(20px);
  transform: translateX(20px);
}
.slider.round {
  border-radius: 24px;
}

.social-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 1.1rem;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.02);
}

body.dark-theme .social-icon {
  background: rgba(255, 255, 255, 0.02);
}

.email-method {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
}

.email-method i {
  color: var(--text-secondary);
  width: 18px;
  height: 18px;
}

.email-method-details span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: block;
}

.email-method-details p {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.tabs-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.tab-btn {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  background: transparent;
  border: none;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--bg-sidebar);
  color: var(--text-primary);
  font-weight: 600;
}

.transactions-list-container {
  display: flex;
  flex-direction: column;
}

.transactions-table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.transactions-list {
  display: flex;
  flex-direction: column;
}

.transaction-row-item {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  padding: 12px;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(0,0,0,0.03);
  align-items: center;
}

body.dark-theme .transaction-row-item {
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.transaction-desc {
  font-weight: 500;
  color: var(--text-primary);
}

.transaction-tokens {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.transaction-tokens.spend {
  color: var(--text-primary);
}

.transaction-tokens.refill {
  color: var(--success);
}

.transaction-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Profile screen header action row and button styles */
.profile-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.back-to-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.back-to-chat-btn:hover {
  background: var(--border-color);
}

.upgrade-tariff-btn {
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.pale-primary-btn {
  background: rgba(10, 124, 255, 0.08);
  color: var(--primary);
}

.pale-primary-btn:hover {
  background: rgba(10, 124, 255, 0.12);
}

body.dark-theme .pale-primary-btn {
  background: rgba(10, 124, 255, 0.15);
}

body.dark-theme .pale-primary-btn:hover {
  background: rgba(10, 124, 255, 0.25);
}

#apply-promocode-btn {
  background: rgba(13, 13, 13, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-weight: 500;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

body.dark-theme #apply-promocode-btn {
  background: rgba(255, 255, 255, 0.08);
}

#apply-promocode-btn:hover {
  background: rgba(13, 13, 13, 0.12);
  border-color: rgba(13, 13, 13, 0.18);
}

body.dark-theme #apply-promocode-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.18);
}

/* Model Selector */
.model-selector-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: var(--radius-pill);
}

.model-select {
  background: transparent;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Image Options */
.image-options {
  display: flex;
  gap: 8px;
}

/* Duplicate image-opt-btn removed to prevent overriding height: 34px defined earlier */

/* Custom Dropdown for Models */
.custom-dropdown {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  min-width: 0;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: background var(--transition-fast);
  max-width: 100%;
  min-width: 0;
}

#selected-model-name, #sig-selected-model-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  min-width: 0;
}

@media (max-width: 768px) {
  .dropdown-trigger {
    max-width: calc(50vw - 36px);
  }
  #selected-model-name, #sig-selected-model-name {
    max-width: none;
    flex: 0 1 auto;
    min-width: 0;
  }
}

.dropdown-trigger:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* Compact model selector in the new-chat composer. The header dropdown has
   its own layout and remains the global model/job navigator. */
.composer-model-dropdown {
  flex-shrink: 0;
}

.composer-model-trigger {
  height: 34px;
  padding: 6px 10px;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  max-width: 180px;
  background: transparent;
}

.composer-model-trigger .dropdown-chevron {
  width: 12px;
  height: 12px;
}

#composer-selected-model-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#composer-model-dropdown-menu {
  bottom: calc(100% + 8px);
  top: auto;
  width: 300px;
  max-height: min(70vh, 440px);
}

.composer-model-menu-title {
  padding: 8px 12px 12px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
}

.composer-model-divider {
  height: 1px;
  margin: 4px -6px 12px;
  background: var(--border-color);
}

.composer-model-section-title {
  padding: 0 12px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 700;
}

.composer-model-section-subtitle {
  padding: 3px 12px 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.dropdown-menu .composer-model-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  min-height: 54px;
  padding: 9px 12px;
}

.dropdown-menu .composer-model-option.active {
  grid-template-columns: 20px minmax(0, 1fr) 18px;
}

.composer-model-option-body {
  min-width: 0;
}

.composer-option-icon {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  min-height: 18px;
  display: block;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.composer-option-icon svg {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  min-height: 18px;
  display: block;
}

.composer-model-option .option-header {
  min-width: 0;
}

.composer-model-option .option-name {
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-model-option .option-desc {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-option-check {
  width: 18px;
  height: 18px;
  color: var(--text-primary);
}

.dropdown-menu .composer-auto-option {
  min-height: 66px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.composer-auto-option .composer-option-icon {
  width: 18px !important;
  height: 18px !important;
}

.composer-auto-option .option-name {
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.25;
}

body.dark-theme .dropdown-trigger:hover {
  background: rgba(255, 255, 255, 0.02);
}

.dropdown-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform var(--transition-normal);
}

.custom-dropdown.active .dropdown-chevron {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 320px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 200;
  animation: fadeInFast 0.12s ease-out;
  max-height: 75vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.dropdown-option {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.dropdown-option:hover {
  background: rgba(0, 0, 0, 0.03);
}

body.dark-theme .dropdown-option:hover {
  background: rgba(255, 255, 255, 0.03);
}

.dropdown-option.active {
  background: rgba(10, 124, 255, 0.06);
}

.dropdown-all-models-btn {
  position: sticky;
  bottom: -6px;
  left: -6px;
  right: -6px;
  width: calc(100% + 12px);
  background-color: var(--bg-panel);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-top: 1px solid var(--border-color);
  font-weight: 500;
  color: var(--primary);
  z-index: 10;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  margin-top: 6px;
  transition: background-color var(--transition-fast);
}

.dropdown-all-models-btn:hover {
  background-color: var(--bg-card);
}

.option-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 2px;
}

.option-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.option-cost {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(10, 124, 255, 0.06);
  border: 1px solid rgba(10, 124, 255, 0.15);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  white-space: nowrap;
}

body.dark-theme .option-cost {
  background: rgba(59, 156, 255, 0.12);
  color: #3b9cff;
  border-color: rgba(59, 156, 255, 0.22);
}

.option-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Aspect Ratio / Format & Resolution dropdown styling */
.format-dropdown-container {
  position: relative;
  display: inline-block;
}

.format-popup {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 1000;
  width: 220px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  animation: fadeInFast 0.12s ease-out;
}

.format-popup-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.format-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.format-option:hover {
  background: rgba(0, 0, 0, 0.03);
}

body.dark-theme .format-option:hover {
  background: rgba(255, 255, 255, 0.03);
}

.format-option.active {
  background: rgba(10, 124, 255, 0.08);
  font-weight: 600;
  color: var(--primary);
}

.format-preview-box {
  display: inline-block;
  border: 1.5px solid var(--text-secondary);
  border-radius: 2px;
  flex-shrink: 0;
}

.format-1-1 { width: 12px; height: 12px; }
.format-2-3 { width: 9px; height: 14px; }
.format-3-2 { width: 14px; height: 9px; }
.format-3-4 { width: 10px; height: 14px; }
.format-4-3 { width: 14px; height: 10px; }
.format-4-5 { width: 11px; height: 14px; }
.format-5-4 { width: 14px; height: 11px; }

.radio-circle {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  margin-left: auto;
  position: relative;
  transition: all var(--transition-fast);
}

.format-option.active .radio-circle {
  border-color: var(--primary);
  background: var(--primary);
}

.format-option.active .radio-circle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
}

/* Welcome Model Title styling */
.welcome-model-title {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.welcome-screen h1, .welcome-screen .welcome-title {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

/* Responsive Mobile Layout (Under 768px) */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 290px;
    height: 100%;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    z-index: 1005;
    background: var(--bg-sidebar);
    box-shadow: 4px 0 24px rgba(13, 13, 13, 0.15);
    border-right: 1px solid var(--border-color);
  }

  #chat-list-wrapper, .chat-list {
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
    flex: none !important;
  }

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

  .close-sidebar-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
  }

  .close-sidebar-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
  }

  .mobile-menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px;
    cursor: pointer;
    border-radius: var(--radius-sm);
  }

  .choose-tariff-btn {
    display: none !important;
  }

  .sidebar-tariff-btn {
    display: block !important;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-pill);
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    width: 100%;
    text-align: center;
  }

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

  #model-dropdown {
    position: static;
  }

  #model-dropdown-menu {
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Chat area occupies full space on mobile */
  .chat-area {
    width: 100%;
    height: 100%;
    max-width: 100%;
  }

  .chat-header {
    padding: 10px 16px;
    height: 56px;
  }

  .chat-history {
    padding: 16px;
  }

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

  .message-bubble.user .msg-content {
    max-width: 85%;
  }

  .chat-input-area {
    padding: 12px 16px 16px 16px;
  }

  .chat-composer-notice {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 8px 10px;
    min-height: 0;
    padding: 12px;
  }
  .chat-composer-notice__icon { width: 34px; height: 34px; flex-basis: 34px; border-radius: 11px; }
  .chat-composer-notice__copy { grid-column: 1; padding-right: 28px; }
  .chat-composer-notice__actions { grid-column: 1; justify-content: flex-start; gap: 4px; margin-right: 0; }
  .chat-composer-notice__primary { padding: 9px 13px; }

  .input-container {
    padding: 10px 14px;
    border-radius: var(--radius-md);
  }

  /* Pricing Modal Grid */
  .modal-card {
    padding: 24px 16px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius-md);
  }

  .pricing-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Auth Screens on mobile */
  .auth-card {
    padding: 24px 20px;
    margin: 16px;
    max-width: 100%;
  }

  /* Profile screen mobile adaptation */
  .profile-scroll-container {
    padding: 16px;
  }

  .user-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .profile-logout-btn {
    width: 100%;
    justify-content: flex-start;
  }

  .tariff-info-row,
  .promocode-row,
  .signin-methods-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .promocode-input-group {
    flex-direction: column;
  }

  .promocode-input-group input {
    width: 100%;
  }

  .promocode-input-group button {
    width: 100%;
  }

  .continue-activation-btn {
    width: 100%;
  }

  .email-method {
    width: 100%;
    justify-content: flex-start;
  }

  /* Transaction table responsiveness */
  .transactions-table-header, .transaction-row-item {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 10px;
  }

  .transactions-table-header span:nth-child(3),
  .transaction-row-item span:nth-child(3) {
    grid-column: span 2;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
  }
}

/* Visual Image Job Cards */
.welcome-jobs-grid.image-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  max-width: 900px;
}

.job-card.image-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--job-card-bg);
  border: 1px solid var(--job-card-border);
  transition: all var(--transition-normal);
  height: 100%;
}

.job-card.image-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-glow);
  box-shadow: 0 8px 24px rgba(10, 124, 255, 0.12);
}

.job-card-img-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

.job-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal) ease;
}

.job-card.image-card:hover .job-card-img {
  transform: scale(1.04);
}

.job-card-info-box {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.job-card-info-box h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-card-info-box p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  height: 2.6em;
}

/* Image Generation Skeleton */
.image-skeleton-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 400px;
}

.image-skeleton-preview {
  width: 100%;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--bg-sidebar) 25%, var(--border-color) 50%, var(--bg-sidebar) 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite linear;
  border: 1px solid var(--border-color);
}

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

.spinner-icon {
  animation: spin 1s linear infinite;
  color: var(--primary);
}

@keyframes loading-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

/* Onboarding Gallery Tabs */
.gallery-tabs-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 16px 0 24px 0;
  flex-wrap: wrap;
  width: 100%;
}

.gallery-tab-btn {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.gallery-tab-btn:hover {
  background: var(--bg-panel);
  color: var(--text-primary);
  border-color: rgba(10, 124, 255, 0.2);
}

.gallery-tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* Pinterest-style Gallery Grid (3 columns count) */
.ideas-gallery-grid {
  display: block !important;
  column-count: 3;
  column-gap: 16px;
  width: 100%;
  max-width: 900px;
  margin-top: 10px;
  padding: 0 16px;
  box-sizing: border-box;
}

.gallery-image-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  cursor: pointer;
  background: var(--bg-sidebar);
  transition: transform var(--transition-normal) ease, box-shadow var(--transition-normal) ease, border-color var(--transition-normal) ease;
  width: 100%;
  break-inside: avoid;
  margin-bottom: 16px;
  display: block;
}

.gallery-image-card img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform var(--transition-normal) ease;
}

.gallery-image-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-glow);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.gallery-image-card:hover img {
  transform: scale(1.03);
}

/* Hover Button Overlay */
.gallery-card-hover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 13, 13, 0.5);
  opacity: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  box-sizing: border-box;
  transition: opacity var(--transition-normal) ease;
  border-radius: var(--radius-lg);
}

.gallery-image-card:hover .gallery-card-hover-overlay {
  opacity: 1;
}

.gallery-card-hover-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateY(8px);
  background: var(--primary);
  color: #fff;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  transition: transform var(--transition-normal) cubic-bezier(0.16, 1, 0.3, 1), background var(--transition-fast) ease;
  box-shadow: 0 4px 12px var(--primary-glow);
  z-index: 2;
}

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

.gallery-image-card:hover .gallery-card-hover-btn {
  transform: translate(-50%, -50%) translateY(0);
}

.gallery-card-hover-info {
  width: 100%;
  max-width: 100%;
  text-align: left;
  transform: translateY(12px);
  transition: transform var(--transition-normal) cubic-bezier(0.16, 1, 0.3, 1);
  color: #ffffff;
  box-sizing: border-box;
  overflow: hidden;
}

.gallery-image-card:hover .gallery-card-hover-info {
  transform: translateY(0);
}

.gallery-card-hover-info h4 {
  margin: 0 0 2px 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-card-hover-info p {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Detail Style Inspector Modal (Larger & More Premium) */
.style-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 11, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  animation: fadeIn var(--transition-fast) ease-out;
}

.style-modal-content {
  width: 100%;
  max-width: 980px;
  background: var(--bg-panel);
  background-clip: padding-box;
  border-radius: 20px;
  border: none;
  overflow: hidden;
  display: flex;
  max-height: calc(100vh - 60px);
  animation: scaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}

body.dark-theme .style-modal-content {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.style-modal-left {
  flex: 1.3;
  min-width: 0;
  background: #0a0a0b;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.style-modal-left img {
  max-width: 100%;
  max-height: 580px;
  object-fit: contain;
  display: block;
}

.style-modal-right {
  width: 390px;
  flex-shrink: 0;
  border-left: 1px solid var(--border-color);
  padding: 32px;
  background: var(--bg-panel);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  max-height: 580px;
}

/* Custom Scrollbar for Modal Sidebar */
.style-modal-right::-webkit-scrollbar {
  width: 6px;
}
.style-modal-right::-webkit-scrollbar-track {
  background: transparent;
}
.style-modal-right::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
.style-modal-right::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.style-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8) !important;
  border: none;
  padding: 0;
  color: #000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all var(--transition-fast);
  z-index: 20;
}

.style-modal-close svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0 !important;
}

.style-modal-close:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 1) !important;
}

.modal-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-title-block h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px 0;
  letter-spacing: -0.3px;
}

.modal-title-block p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.45;
}

.modal-prompt-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-prompt-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-prompt-title-row span {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.copy-prompt-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.copy-prompt-btn:hover {
  background: rgba(10, 124, 255, 0.05);
}

.prompt-box {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
  word-break: break-word;
  max-height: 160px;
  overflow-y: auto;
}

/* Custom Scrollbar for Prompt Box */
.prompt-box::-webkit-scrollbar {
  width: 4px;
}
.prompt-box::-webkit-scrollbar-track {
  background: transparent;
}
.prompt-box::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.style-chip {
  background: rgba(10, 124, 255, 0.06);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(10, 124, 255, 0.12);
}

.modal-primary-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 14px;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--transition-fast);
  box-shadow: 0 4px 14px var(--primary-glow);
}

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

.modal-sub-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.modal-secondary-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-secondary-btn:hover {
  background: var(--bg-sidebar);
  border-color: var(--text-muted);
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Responsiveness for Style Modal */
@media (max-width: 768px) {
  .style-modal-overlay {
    align-items: flex-start;
    overflow-y: auto;
    padding: 24px 16px;
  }

  .style-modal-content {
    flex-direction: column;
    max-height: none;
    margin: auto;
  }
  
  .style-modal-left {
    flex: none;
    height: 280px;
  }
  
  .style-modal-left img {
    height: 100%;
    object-fit: cover;
  }
  
  .style-modal-right {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-color);
    max-height: none;
    overflow-y: visible;
    padding: 20px;
    gap: 20px;
  }
  
  .ideas-gallery-grid {
    column-count: 2;
    column-gap: 12px;
  }
  
  .gallery-image-card {
    margin-bottom: 12px;
  }
}

@media (max-width: 480px) {
  .ideas-gallery-grid {
    column-count: 1;
  }
  .ideas-gallery-grid.vertical-cards {
    column-count: 2;
  }
}

/* Files Screen Styles */
.files-scroll-container {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-main);
  padding: 24px;
  height: 100%;
}
.files-content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.files-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.files-header-title h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.files-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
  margin-left: 16px;
}
.search-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 250px;
}
@media (max-width: 600px) {
  .search-input-wrapper {
    max-width: 100%;
  }
}
.search-input-wrapper input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border-radius: 99px;
  border: 1px solid var(--border-color);
  background: var(--bg-panel);
  color: var(--text-primary);
  outline: none;
  font-size: 0.85rem;
  transition: border-color var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}
.search-input-wrapper input:focus {
  border-color: var(--primary);
}
.search-input-wrapper i,
.search-input-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

@media (max-width: 768px) {
  .search-input-wrapper input {
    font-size: 16px !important;
    padding-left: 36px !important;
  }
}
.files-view-toggle {
  display: flex;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
}
.files-view-toggle .view-btn {
  border: none;
  background: transparent;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.files-view-toggle .view-btn.active {
  background: var(--bg-sidebar);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* Tabs Bar */
.files-tabs-row {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  overflow-x: auto;
}
.files-tab-btn {
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.files-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(0,0,0,0.02);
}
body.dark-theme .files-tab-btn:hover {
  background: rgba(255,255,255,0.02);
}
.files-tab-btn.active {
  background: rgba(10, 124, 255, 0.08);
  color: var(--primary);
  font-weight: 600;
}

/* Empty state */
.files-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  gap: 16px;
}
.files-empty-icon {
  font-size: 4rem;
  color: #f59e0b;
  animation: bounce 2s infinite;
}
.files-empty-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}
.files-empty-state p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 400px;
}

/* Group & Month sections */
.files-month-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.files-month-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: capitalize;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

/* Cards Grid */
.files-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.file-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
}
.file-card:hover {
  transform: translateY(-2px);
  border-color: rgba(10, 124, 255, 0.4);
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.file-card-preview {
  height: 180px;
  background: rgba(0,0,0,0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.file-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.file-card:hover .file-card-preview img {
  transform: scale(1.03);
}
.file-card-icon-fallback {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}
.file-card-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--border-color);
}
.file-card-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.file-card-type-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.file-card-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* List Table View */
.files-list-container {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  overflow: hidden;
}
.files-list-header {
  display: grid;
  grid-template-columns: 3fr 1.5fr 1.5fr 1fr;
  padding: 12px 16px;
  background: rgba(0,0,0,0.01);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}
.file-list-row {
  display: grid;
  grid-template-columns: 3fr 1.5fr 1.5fr 1fr;
  padding: 12px 16px;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(0,0,0,0.03);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.file-list-row:last-child {
  border-bottom: none;
}
.file-list-row:hover {
  background: rgba(10, 124, 255, 0.02);
}
.file-list-name-col {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.file-list-preview-mini {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: rgba(0,0,0,0.02);
}
.file-list-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-list-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.file-action-btn {
  border: none;
  background: transparent;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}
.file-action-btn:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text-primary);
}
body.dark-theme .file-action-btn:hover {
  background: rgba(255,255,255,0.05);
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox-modal.hidden {
  display: none !important;
}
.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 13, 13, 0.6);
  backdrop-filter: blur(4px);
}
.lightbox-content {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 800px;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: calc(100vh - 48px); /* Учитывает padding 24px * 2 у .lightbox-modal */
  position: relative;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  z-index: 10;
}
.lightbox-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  border: none;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  color: #000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all var(--transition-fast);
  z-index: 20;
}
.lightbox-close-btn:hover {
  transform: scale(1.05);
  background: var(--border-color);
}
.lightbox-body {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 70vh;
  overflow: hidden;
  background: rgba(0,0,0,0.02);
}
.lightbox-body img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.lightbox-footer {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  border-top: 1px solid var(--border-color);
}
.lightbox-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lightbox-filename {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}
.lightbox-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lightbox-actions .primary-btn, .lightbox-actions .secondary-btn {
  padding: 8px 16px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lightbox-actions .btn-link {
  text-decoration: none;
}

/* Attached file pill styles in message box */
.attached-artifact-container {
  display: flex;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0,0,0,0.01);
  align-items: center;
  flex-wrap: wrap;
}
body.dark-theme .attached-artifact-container {
  background: rgba(255, 255, 255, 0.01);
}
.attached-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px 10px;
  font-size: 0.8rem;
  color: var(--text-primary);
  max-width: 240px;
  position: relative;
  animation: scaleIn 0.15s ease-out;
}
.attached-pill-preview {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: rgba(0,0,0,0.02);
}
.attached-pill-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.attached-pill-remove {
  border: none;
  background: transparent;
  padding: 2px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.attached-pill-remove:hover {
  background: rgba(0,0,0,0.05);
  color: var(--danger);
}
body.dark-theme .attached-pill-remove:hover {
  background: rgba(255,255,255,0.05);
}

/* Custom styles for files page layout & mobile state */
.files-header {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  background: var(--bg-main);
  z-index: 10;
  box-sizing: border-box;
}
.files-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.file-card-prompt {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  text-align: left;
}

@media (max-width: 768px) {
  .files-header {
    padding: 10px 16px;
    height: 56px;
    position: sticky;
    top: 0;
    width: 100%;
  }
  .files-header-title h2 {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .files-scroll-container {
    padding: 16px;
  }
  /* Отображение на мобилке по 2 карточки в строчку */
  .files-grid-container {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .file-card-preview {
    height: 120px !important;
  }
  .file-card-info {
    padding: 8px !important;
  }
  .file-card-name {
    font-size: 0.8rem !important;
  }
  .file-card-prompt {
    -webkit-line-clamp: 1 !important;
    font-size: 0.7rem !important;
  }

  /* Lightbox Mobile Adjustments */
  .lightbox-footer {
    padding: 12px 16px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .lightbox-info {
    text-align: left !important;
    align-items: flex-start !important;
  }
  .lightbox-actions {
    justify-content: center !important;
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .lightbox-actions button, .lightbox-actions a {
    flex: 1 1 calc(50% - 8px) !important;
    justify-content: center !important;
    font-size: 0.8rem !important;
    padding: 8px 10px !important;
  }
  #lightbox-chat-btn {
    flex-basis: 100% !important; /* Full width for the chat redirect button to look balanced */
  }
}

/* Custom User Job Cards */
.user-job-card {
  border-color: rgba(139, 92, 246, 0.25) !important;
}
body.dark-theme .user-job-card {
  border-color: rgba(139, 92, 246, 0.4) !important;
}
.user-job-card .job-icon {
  background: rgba(139, 92, 246, 0.08) !important;
  color: #8b5cf6 !important;
}
.user-job-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.2);
  padding: 2px 6px;
  height: 18px;
  border-radius: var(--radius-pill);
  cursor: help;
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}
.user-job-tooltip:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
}
body.dark-theme .user-job-tooltip {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.3);
}

/* Prompt Screen & Cards Responsiveness */
.prompt-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  min-height: 180px;
  box-sizing: border-box;
  cursor: default;
}
.prompt-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.prompt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}
.prompt-card-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.prompt-card-icon {
  width: 16px;
  height: 16px;
  color: var(--primary);
  flex-shrink: 0;
}
.prompt-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.prompt-card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
  text-align: left;
}
.prompt-card-content {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  text-align: left;
}
.prompt-card .use-prompt-btn {
  padding: 8px 12px;
  font-size: 0.8rem;
  width: 100%;
  justify-content: center;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 768px) {
  .prompt-card {
    padding: 12px !important;
    min-height: 160px !important;
    gap: 10px !important;
  }
  .prompt-card-title-group h4 {
    font-size: 0.85rem !important;
  }
  .prompt-card-desc {
    font-size: 0.75rem !important;
  }
  .prompt-card-content {
    font-size: 0.7rem !important;
    -webkit-line-clamp: 2 !important;
  }
  .prompt-card .use-prompt-btn {
    padding: 6px 10px !important;
    font-size: 0.75rem !important;
  }
}

@media (max-width: 600px) {
  .btn-text-responsive {
    display: none;
  }
  #share-chat-btn {
    padding: 0 !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    margin: 0 8px !important;
    flex-shrink: 0 !important;
  }
  #share-chat-btn-icon {
    margin: 0 !important;
  }
  #prompts-create-btn {
    padding: 0 !important;
    border-radius: 50% !important;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    flex-shrink: 0;
    justify-content: center;
  }
}

/* User Job Card top-left text badge */
.user-job-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.08);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.2);
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: 6px;
  line-height: 1;
  height: 22px;
  box-sizing: border-box;
}

body.dark-theme .user-job-badge {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.3);
}

/* Guest Mode Styles */
body.guest-mode .sidebar {
  display: none !important;
}

body.guest-mode .chat-area {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

body.guest-mode .chat-header {
  padding-left: 16px !important;
  justify-content: space-between;
}

body.guest-mode .guest-only-logo {
  display: flex !important;
}

@media (max-width: 768px) {
  body.guest-mode .guest-only-logo h2 {
    display: none !important;
  }
}

body.guest-mode .mobile-menu-toggle,
body.guest-mode #mobile-menu-toggle {
  display: none !important;
}

body.guest-mode .choose-tariff-btn {
  display: none !important;
}

/* A guest in the calories-only view (an ad or the quiz led them to the diary) keeps the
   left menu of the mode: «Дневник питания», «Тренировки» and the rest (decision 2026-11-12).
   On a phone the menu stays behind the burger, as for a signed-in person. */
body.guest-mode.nutrition-focus-mode .sidebar { display: flex !important; }
body.guest-mode .sidebar-tariff-btn { display: none !important; }
body.guest-mode.nutrition-focus-mode .chat-area { margin-left: revert !important; width: auto !important; max-width: none !important; }
@media (max-width: 768px) {
  body.guest-mode.nutrition-focus-mode #mobile-menu-toggle { display: inline-flex !important; }
}
@media (min-width: 769px) {
  body.guest-mode.nutrition-focus-mode .guest-only-logo { display: none !important; }
}

/* Natal Chart Guest Mode Overlay */
.natal-guest-blur {
  max-height: 400px;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

/* Free users get a 2.5x larger preview than guests: 1000px vs 400px. */
.natal-free-blur {
  max-height: 1000px;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.natal-show-more-btn {
  margin-top: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: background var(--transition-fast);
}

.natal-show-more-btn:hover {
  background: var(--primary-hover);
}

/* Human Design & Matrix Guest Mode Overlay */
.hd-guest-blur,
.matrix-guest-blur,
.matrix-compat-guest-blur {
  display: -webkit-box;
  -webkit-line-clamp: 10;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

/* Free users get 25 lines instead of the guest preview's 10 lines. */
.hd-free-blur,
.matrix-free-blur {
  display: -webkit-box;
  -webkit-line-clamp: 25;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(to bottom, black 75%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 75%, transparent 100%);
}

/* Sidebar Referral Button */
.sidebar-referral-promo-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% - 40px);
  margin: 12px 20px 4px 20px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(10, 124, 255, 0.08) 0%, rgba(10, 124, 255, 0.02) 100%);
  border: 1px solid rgba(10, 124, 255, 0.15);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.sidebar-referral-promo-btn:hover {
  background: linear-gradient(135deg, rgba(10, 124, 255, 0.12) 0%, rgba(10, 124, 255, 0.06) 100%);
  border-color: rgba(10, 124, 255, 0.3);
  transform: translateY(-1px);
}

.sidebar-referral-promo-btn:active {
  transform: translateY(0);
}

.sidebar-referral-promo-btn .promo-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.sidebar-referral-promo-btn .promo-icon-box i {
  width: 18px;
  height: 18px;
}

.sidebar-referral-promo-btn .promo-text-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-referral-promo-btn .promo-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.sidebar-referral-promo-btn .promo-desc {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.2;
}

body.dark-theme .sidebar-referral-promo-btn {
  background: linear-gradient(135deg, rgba(59, 156, 255, 0.1) 0%, rgba(59, 156, 255, 0.02) 100%);
  border-color: rgba(59, 156, 255, 0.2);
}
body.dark-theme .sidebar-referral-promo-btn:hover {
  background: linear-gradient(135deg, rgba(59, 156, 255, 0.15) 0%, rgba(59, 156, 255, 0.05) 100%);
  border-color: rgba(59, 156, 255, 0.35);
}

/* Referral Modal Styles */
.referral-modal-content {
  max-width: 480px;
  width: 100%;
  border-radius: 24px;
}

.referral-modal-body {
  padding: 24px 28px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.referral-hero {
  background: linear-gradient(135deg, rgba(10, 124, 255, 0.08) 0%, rgba(10, 124, 255, 0.02) 100%);
  border: 1px solid rgba(10, 124, 255, 0.1);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
  position: relative;
}

.referral-hero-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.referral-hero-content h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

.referral-hero-content p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.referral-hero-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.referral-hero-graphics {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.graphics-bubble {
  position: absolute;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.bubble-1 {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #ff416c, #ff4b2b);
  color: #fff;
  z-index: 2;
}

.bubble-2 {
  width: 28px;
  height: 28px;
  background: #ffb300;
  color: #fff;
  top: 0;
  left: 10px;
}

.bubble-3 {
  width: 32px;
  height: 32px;
  background: #0a7cff;
  color: #fff;
  bottom: 0;
  right: 10px;
}

.bubble-4 {
  width: 24px;
  height: 24px;
  background: #a855f7;
  color: #fff;
  bottom: 40px;
  left: 5px;
}

.graphics-bubble i {
  width: 14px;
  height: 14px;
}
.bubble-1 i {
  width: 20px;
  height: 20px;
}

.referral-section h3 {
  margin: 0 0 12px 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.referral-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.referral-steps li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.referral-steps .step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(10, 124, 255, 0.1);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.referral-steps .step-text {
  font-size: 0.88rem;
  color: var(--text-primary);
  font-weight: 500;
}

.referral-link-box {
  display: flex;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 6px 6px 6px 14px;
  align-items: center;
}

.referral-link-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  color: var(--text-secondary);
  outline: none;
  min-width: 0;
}

.referral-link-box button {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 8px;
  margin: 0;
  height: 36px;
}

.referral-guest-box {
  background: var(--bg-secondary);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.referral-guest-box p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.referral-guest-box button {
  align-self: center;
  padding: 8px 20px;
  font-size: 0.85rem;
  border-radius: 8px;
  height: 36px;
  margin: 0;
}

.referral-modal-footer-text {
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.referral-modal-footer-text a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

body.dark-theme .referral-hero {
  background: linear-gradient(135deg, rgba(59, 156, 255, 0.1) 0%, rgba(59, 156, 255, 0.02) 100%);
  border-color: rgba(59, 156, 255, 0.15);
}

body.dark-theme .referral-steps .step-num {
  background: rgba(59, 156, 255, 0.15);
  color: #3b9cff;
}

/* ==========================================================================
   NETS CATALOG SCREEN
   ========================================================================== */
.nets-grid-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
}

@media (max-width: 1024px) {
  .nets-grid-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .nets-grid-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .net-card {
    padding: 14px;
    gap: 12px;
    border-radius: var(--radius-md);
  }
  .net-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }
  .net-card-icon i {
    width: 18px !important;
    height: 18px !important;
  }
  .net-card-title {
    font-size: 0.95rem;
  }
  .net-card-desc {
    font-size: 0.75rem;
    line-height: 1.4;
    height: 4.2em; /* 3 lines of 1.4 line-height */
  }
  .net-card-btn {
    font-size: 0.8rem;
    padding: 8px 12px;
  }
}

.net-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

body.dark-theme .net-card {
  background: var(--bg-panel);
  border-color: var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.net-card:hover {
  transform: translateY(-4px);
  border-color: rgba(10, 124, 255, 0.35);
  box-shadow: 0 12px 30px rgba(10, 124, 255, 0.06);
}

body.dark-theme .net-card:hover {
  border-color: rgba(59, 156, 255, 0.35);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.net-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.net-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-normal);
}

.net-card:hover .net-card-icon {
  transform: scale(1.05) rotate(3deg);
}


.net-card-badge {
  background: rgba(10, 124, 255, 0.06);
  border: 1px solid rgba(10, 124, 255, 0.15);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

@media (hover: hover) {
  .net-card-badge {
    opacity: 0;
    transform: translateY(2px);
    pointer-events: none;
  }
  .net-card:hover .net-card-badge {
    opacity: 1;
    transform: translateY(0);
  }
}

body.dark-theme .net-card-badge {
  background: rgba(59, 156, 255, 0.12);
  color: #3b9cff;
  border-color: rgba(59, 156, 255, 0.22);
}

.net-card-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.net-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
  transition: color var(--transition-fast);
}

.net-card:hover .net-card-title {
  color: var(--primary);
}

.net-card-provider {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.net-card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 4.5em; /* Exactly 3 lines */
  flex-shrink: 0;
}

.net-card-footer {
  margin-top: 4px;
  width: 100%;
}

.net-card-btn {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: rgba(10, 124, 255, 0.08);
  color: var(--primary);
  border: 1px solid rgba(10, 124, 255, 0.15);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

body.dark-theme .net-card-btn {
  background: rgba(59, 156, 255, 0.12);
  color: #3b9cff;
  border-color: rgba(59, 156, 255, 0.2);
}

.net-card:hover .net-card-btn {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* Share Chat Popover */
.share-chat-popover {
  width: 320px;
  max-width: calc(100vw - 32px);
  left: auto;
  right: 0;
  top: calc(100% + 8px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  border-radius: 12px;
  z-index: 10000;
  cursor: default;
  border: 1px solid var(--border-color);
  background: var(--bg-panel);
}

@media (max-width: 768px) {
  .share-chat-popover {
    position: fixed;
    top: 68px; /* Below the header */
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
    margin: 0 auto;
  }
}

/* Muza AI Icon Styling */
.muza-icon {
  font-size: 1.2em; /* Default size for dropdowns and triggers */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: var(--text-primary); /* Remove blue color, inherit standard text color */
}

/* For main screens, override font-size */
.welcome-model-icon .muza-icon,
.net-card-icon .muza-icon {
  font-size: 2.2em;
}

body.recovery-mode .sidebar { display: none !important; }
body.guest-nets-mode .sidebar { display: none !important; }
body.guest-nets-mode .mobile-menu-toggle { display: none !important; }

/* «Только калории» (decision 2026-11-10): only the calories chat, its tabs,
   the tariffs and the profile. The sidebar keeps the logo, «Выбрать тариф»
   and the account. */
body.nutrition-focus-mode #new-chat-btn,
body.nutrition-focus-mode .sidebar-menu-items,
body.nutrition-focus-mode #chat-list-wrapper,
body.nutrition-focus-mode #model-dropdown,
body.nutrition-focus-mode #composer-model-dropdown,
body.nutrition-focus-mode #header-balance-container,
body.nutrition-focus-mode #share-chat-btn,
body.nutrition-focus-mode #share-chat-popover,
body.nutrition-focus-mode #welcome-models-container,
body.nutrition-focus-mode #welcome-tabs-container,
body.nutrition-focus-mode #profile-token-packages { display: none !important; }

/* The sections of the mode: the calories chat tabs, the coach and «Мои данные». */
.sidebar-focus-menu { display: none; }
/* The same look as .sidebar-menu-items: 20px side padding, so hover and active stay off the edges. */
body.nutrition-focus-mode .sidebar-focus-menu { display: flex; flex-direction: column; gap: 2px; padding: 8px 20px; }
.sidebar-focus-menu .icon-btn-text { gap: 10px; padding: 10px 14px; margin: 3px 0; transition: background var(--transition-fast), color var(--transition-fast); }
.sidebar-focus-menu .icon-btn-text.active { background: rgba(10, 124, 255, 0.08); color: var(--primary); }
.sidebar-focus-menu .icon-btn-text.active:hover { background: rgba(10, 124, 255, 0.12); }
body.dark-theme .sidebar-focus-menu .icon-btn-text.active { background: rgba(10, 124, 255, 0.15); color: #3b9cff; }
body.dark-theme .sidebar-focus-menu .icon-btn-text.active:hover { background: rgba(10, 124, 255, 0.2); }
.sidebar-focus-sep { height: 1px; background: var(--border-color); margin: 6px 0; }

/* Notification Banner */
.notification-banner {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  padding: 16px 20px;
  width: auto;
  max-width: 90vw;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.notification-banner.hidden {
  opacity: 0;
  transform: translate(-50%, -100px);
  pointer-events: none;
}

.notification-banner-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.notification-banner-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notification-banner-text h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.notification-banner-text p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.notification-enable-btn {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.notification-enable-btn:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.notification-enable-btn:active {
  transform: translateY(1px);
}

.notification-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  color: var(--text-muted);
}

.notification-close-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

@media (max-width: 640px) {
  .notification-banner-content {
    gap: 12px;
  }
  .notification-banner-text h4 {
    font-size: 0.95rem;
  }
  .notification-banner-text p {
    font-size: 0.8rem;
  }
  .notification-enable-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
  }
}

@media (max-width: 768px) {
  .user-card {
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
    padding: 24px 20px;
  }

  .user-avatar-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
  }

  .user-meta {
    width: 100%;
    word-break: break-word;
  }

  .profile-logout-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Chat Input Mobile Options Row */
@media (max-width: 600px) {
  .chat-options-row {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .chat-options-row::-webkit-scrollbar {
    display: none;
  }

  #composer-model-dropdown-menu {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 8px;
    top: auto;
    width: auto;
    max-width: none;
    max-height: 65vh;
    border-radius: 20px;
    padding: 8px;
    z-index: 9999;
  }
  
  .format-popup {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15) !important;
    margin: 0 !important;
    max-height: 50vh;
    overflow-y: auto;
    z-index: 9999 !important;
    padding-bottom: env(safe-area-inset-bottom, 20px) !important;
  }
}

/* Dictation Button Recording State */
@keyframes pulse-record {
  0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4); background-color: rgba(255, 59, 48, 0.1); color: #ff3b30; }
  70% { box-shadow: 0 0 0 10px rgba(255, 59, 48, 0); background-color: rgba(255, 59, 48, 0.2); color: #ff3b30; }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); background-color: rgba(255, 59, 48, 0.1); color: #ff3b30; }
}

.dictation-btn[hidden] { display:none !important; }
.dictation-btn.recording {
  animation: pulse-record 1.5s infinite !important;
  border-color: #ff3b30 !important;
  color: #ff3b30 !important;
  background-color: rgba(255, 59, 48, 0.1) !important;
}
.dictation-btn.recording svg {
  color: #ff3b30 !important;
}

/* Prevent iOS input zoom on mobile by enforcing 16px font-size */
@media screen and (max-width: 768px) {
  input[type="text"], input[type="email"], input[type="number"], input[type="password"], input[type="tel"], input[type="url"], textarea, select, .style-search-input {
    font-size: 16px !important;
  }

  #message-input::placeholder {
    font-size: 16px;
  }
}


@media screen and (max-width: 768px) {
  .guest-only-footer {
    flex-direction: column;
    gap: 8px;
    padding-bottom: 24px;
  }
}

/* ==========================================================================
   Muza AI Studio Styles
   ========================================================================== */

.studio-workspace {
  background: var(--bg-main);
  padding: 16px 20px 40px;
  container-type: inline-size;
}

.studio-home {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 0;
}

.studio-home-heading { margin-bottom: 30px; }
.studio-home-eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--primary); font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.studio-home-eyebrow svg { width: 17px; height: 17px; }
.studio-home-heading h1 { font-size: clamp(28px, 4.2cqi, 40px); line-height: 1.15; font-weight: 650; letter-spacing: -1.2px; margin-bottom: 12px; }
.studio-home-heading p { font-size: 16px; line-height: 1.5; color: var(--text-secondary); }
.studio-entry-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.studio-entry-card { position: relative; display: flex; flex-direction: column; min-width: 0; width: 100%; padding: 0; overflow: hidden; border: 1px solid var(--border-color); border-radius: 24px; background: var(--bg-panel); color: var(--text-primary); font: inherit; text-align: left; text-decoration: none; }
button.studio-entry-card { cursor: pointer; transition: border-color .18s, box-shadow .18s, transform .18s; }
button.studio-entry-card:hover { border-color: rgba(10, 124, 255, .4); box-shadow: 0 12px 32px rgba(10, 60, 120, .08); transform: translateY(-3px); }
button.studio-entry-card:focus-visible, .studio-back-btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
.studio-entry-image { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: #edf5ff; }
.studio-entry-body { display: flex; flex: 1; flex-direction: column; align-items: flex-start; padding: 24px; }
.studio-entry-title { font-size: 21px; font-weight: 600; line-height: 1.25; letter-spacing: -.5px; margin-bottom: 10px; }
.studio-entry-description { font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin-bottom: 26px; }
.studio-entry-action, .studio-entry-soon { margin-top: auto; font-size: 14px; font-weight: 600; line-height: 24px; }
.studio-entry-action { display: inline-flex; align-items: center; gap: 7px; color: var(--primary); }
.studio-entry-action svg { width: 17px; height: 17px; }
.studio-entry-coming { background: var(--bg-card); }
.studio-entry-coming .studio-entry-image { opacity: .85; }
.studio-entry-image-wrap { position: relative; }
.studio-entry-badge { position: absolute; top: 16px; right: 16px; padding: 5px 12px; border-radius: 99px; background: var(--bg-panel); color: var(--text-primary); font-size: 12px; font-weight: 600; box-shadow: 0 2px 12px rgba(0, 0, 0, .04); }
.studio-entry-soon { color: var(--text-muted); font-weight: 500; }
.studio-workspace-nav { display: flex; flex-direction: column; gap: 18px; }
.studio-back-btn { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; min-height: 44px; border: 0; padding: 0; background: transparent; font: inherit; font-size: 14px; color: var(--text-secondary); cursor: pointer; }
.studio-back-btn svg { width: 17px; height: 17px; }
.studio-workspace-heading { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.studio-workspace-heading h2 { font-size: 24px; font-weight: 600; letter-spacing: -.6px; }
.studio-task-tabs { display: flex; gap: 4px; width: min(100%, 420px); box-sizing: border-box; padding: 4px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-secondary); }
.studio-task-tab { display: inline-flex; flex: 1; flex-wrap: wrap; align-items: center; justify-content: center; gap: 3px 6px; min-width: 0; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-secondary); font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; }
.studio-task-tab[aria-selected="true"] { background: var(--primary); color: #fff; }
.studio-task-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.studio-task-tab:disabled { cursor: default; opacity: .55; }
.studio-task-soon { padding: 2px 5px; border-radius: 5px; background: var(--bg-panel); color: var(--text-secondary); font-size: .62rem; line-height: 1.3; }
@container (min-width: 760px) { .studio-entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 759px) { .studio-home { max-width: 520px; padding: 20px 0; } }
@container (max-width: 360px) { .studio-entry-body { padding: 20px; } .studio-entry-title { font-size: 20px; } .studio-home-heading h1 { letter-spacing: -.7px; } }
@media (max-width: 767px) {
  .studio-entry-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 84%;
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    padding: 4px 4px 12px;
  }
  .studio-entry-card { border-radius: 18px; scroll-snap-align: start; }
  .studio-entry-body { padding: 16px; }
  .studio-entry-title { font-size: 18px; margin-bottom: 8px; }
  .studio-entry-description { font-size: 13px; line-height: 1.5; margin-bottom: 16px; }
  .studio-entry-action { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { button.studio-entry-card { transition: none; } button.studio-entry-card:hover { transform: none; } }

.studio-content-wrapper {
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.studio-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.studio-section-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.studio-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.studio-count-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--primary-glow);
  color: var(--primary);
}

.studio-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Source Strip */
.studio-source-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 4px 12px;
  align-items: center;
  scrollbar-width: thin;
}

.studio-add-source-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 144px;
  height: 144px;
  min-width: 144px;
  border: 1.5px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.studio-add-source-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
}

.studio-source-card {
  position: relative;
  width: 144px;
  height: 144px;
  min-width: 144px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-panel);
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.studio-source-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.studio-source-card.is-primary {
  border: 2px solid #eab308;
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.25);
}

.studio-source-pending {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 144px;
  height: 144px;
  min-width: 144px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.studio-source-pending .spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.studio-source-pending,
.studio-source-card.is-loading {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--border-color) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: studio-shimmer 1.5s infinite;
}

.studio-source-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.studio-source-star-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #eab308;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: var(--radius-pill);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 2px;
}

.studio-source-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.studio-source-card:hover .studio-source-delete-btn {
  opacity: 1;
}

.studio-source-open-card-btn {
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 4px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.72rem;
  padding: 4px 5px;
  text-align: center;
  opacity: 0;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.studio-source-card:not(.is-primary) .studio-source-open-card-btn:first-of-type {
  bottom: 42px;
}

.studio-source-card:hover .studio-source-open-card-btn {
  opacity: 1;
}

/* Product Title & Category Row (Unified Plate) */
.studio-product-title-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.studio-product-title-label {
  font-size: 0.95rem;
  font-style: italic;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  padding-top: 8px;
}

.studio-product-meta-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.studio-product-title-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.studio-product-title-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.studio-product-title-input {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 2px 0;
  font-family: inherit;
}

.studio-product-title-input::placeholder {
  color: var(--text-muted);
  font-style: normal;
  font-weight: 400;
}

.studio-product-title-loader {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-left: 8px;
  white-space: nowrap;
}

.studio-product-title-loader .spinner-sm {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.studio-category-select-wrapper {
  position: relative;
  width: 100%;
}

.studio-category-status { margin-top: 8px; color: var(--text-secondary); font-size: .8rem; line-height: 1.5; }
.studio-category-status button { display: block; margin-top: 6px; padding: 0; border: 0; background: none; color: var(--primary); font: inherit; cursor: pointer; }
.studio-category-status[hidden], .studio-category-status button[hidden] { display: none; }
.studio-product-editor .studio-category-select-wrapper:has(.studio-category-status:not([hidden]))::after { top: 22px; }

.studio-category-select-wrapper select.studio-category-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.studio-category-select-wrapper select.studio-category-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Settings Card */
.studio-settings-card {
  padding: 20px;
}

.studio-settings-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.studio-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.studio-field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

[data-v2-detail-mode-field] { display: grid; gap: 6px; margin-top: 12px; }
[data-v2-detail-mode-field] .studio-select { min-height: 44px; }

.studio-text-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

.studio-input, .studio-select, .studio-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.studio-input:focus, .studio-select:focus, .studio-textarea:focus {
  border-color: var(--primary);
}

/* Category Chips */
.studio-category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.studio-category-chip {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.studio-category-chip:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.studio-category-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Mode Toggle */
.studio-mode-toggle {
  display: inline-flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 4px;
  width: fit-content;
}

.studio-mode-btn {
  padding: 6px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.studio-mode-btn:hover {
  color: var(--text-primary);
}

.studio-mode-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* Card Text Section */
.studio-card-text-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 4px;
}

.studio-field-counter {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Image editor presets use the same compact, swipeable choices as card mode. */
.studio-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 2px 3px 8px;
}

@media (max-width: 640px) {
  .studio-presets-grid {
    grid-auto-flow: column;
    grid-auto-columns: clamp(136px, 36vw, 164px);
    grid-template-columns: none;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
}

.studio-preset-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 5px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  align-items: center;
  outline: none;
  scroll-snap-align: start;
}

.studio-preset-card:hover {
  border-color: var(--primary);
  background: var(--bg-panel);
}

.studio-preset-card:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.studio-preset-card.active {
  border: 2px solid var(--primary);
  background: var(--primary-glow);
  box-shadow: 0 2px 10px var(--primary-glow);
}

.studio-preset-thumb-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.studio-preset-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity var(--transition-fast);
}

.studio-preset-thumb.has-error {
  display: none;
}

.studio-preset-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.25;
  word-break: break-word;
}

/* Card Reference Slots (Режим "Карточка") */
.studio-card-reference-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.studio-reference-slots-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.studio-ref-slot-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 140px;
}

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

.studio-ref-slot-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.studio-ref-slot-card {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.studio-ref-upload-card {
  border-style: dashed;
  border-width: 1.5px;
  cursor: pointer;
}

.studio-ref-upload-card:hover {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.05);
}

.studio-ref-upload-card:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.studio-ref-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.studio-ref-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted);
  text-align: center;
  padding: 8px;
}

.studio-ref-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 140px;
}

.studio-ref-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.studio-ref-reset-btn {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.studio-ref-reset-btn:hover {
  color: #f87171;
}

/* Prompt / Wishes Textarea */
.studio-scene-ideas { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.studio-scene-idea-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 8px 16px; border: 1px solid var(--border-color); border-radius: var(--radius-pill); background: var(--bg-card); color: var(--text-primary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.studio-scene-idea-btn svg { width: 16px; height: 16px; color: var(--primary); }
.studio-scene-idea-btn:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-glow); }
.studio-scene-idea-btn:disabled { opacity: .5; cursor: default; }
.studio-scene-idea-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
@media (max-width: 640px) { #studio-prompt-input { font-size: 16px; } }

.studio-prompt-textarea {
  min-height: 96px;
  max-height: 240px;
  resize: vertical;
  line-height: 1.5;
  padding: 10px 14px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.studio-prompt-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
  outline: none;
}

/* Examples Modal & Button */
.studio-ref-examples-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.studio-ref-examples-btn:hover {
  opacity: 0.85;
  background: rgba(255, 255, 255, 0.05);
}

.studio-examples-content {
  max-width: 980px;
  max-height: 85vh;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.studio-examples-header {
  margin-bottom: 18px;
  padding-right: 36px;
}

.studio-examples-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.studio-examples-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.studio-examples-subtitle {
  margin: 6px 0 0 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.studio-examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  overflow-y: auto;
  max-height: calc(85vh - 120px);
  padding: 4px;
}

@media (max-width: 600px) {
  .studio-examples-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

.studio-example-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  text-align: left;
  padding: 0;
  outline: none;
}

.studio-example-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 4px 16px var(--primary-glow);
}

.studio-example-card:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}

.studio-example-card.active {
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.studio-example-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #000;
}

.studio-example-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.studio-example-info {
  padding: 8px 10px;
}

.studio-example-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

/* Action Row */
.studio-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.studio-format-scroll { position: relative; width: 100%; min-width: 0; }
.studio-format-next { display: none; }
.studio-format-next[hidden] { display: none; }

.studio-format-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.studio-format-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

/* Miniature frame with the button's proportions. */
.studio-format-btn::before {
  content: '';
  flex: none;
  height: 12px;
  aspect-ratio: var(--format-ratio, 1 / 1);
  border: 1.5px solid currentColor;
  border-radius: 2px;
  opacity: 0.7;
}

.studio-format-btn.active {
  background: var(--text-primary);
  color: var(--bg-main);
  border-color: var(--text-primary);
}

.studio-primary-cta {
  min-height: 64px;
  padding: 18px 24px;
  border-radius: var(--radius-pill);
  font-size: 1.05rem;
  line-height: 1.4;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
}

@media (max-width: 540px) {
  .studio-primary-cta { padding-inline: 16px; }
}

/* Results Grid */
.studio-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.studio-frame-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-panel);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  display: flex;
  flex-direction: column;
}

.studio-frame-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.studio-frame-thumb-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--bg-card);
  overflow: hidden;
}

.studio-frame-thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.studio-frame-pos-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  backdrop-filter: blur(4px);
}

.studio-frame-intent-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(10, 124, 255, 0.85);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  backdrop-filter: blur(4px);
}

.studio-frame-info {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-frame-variant-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
}

.studio-frame-variants-count {
  font-size: 0.7rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .studio-results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .studio-frame-info {
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 8px;
  }
}

/* Skeleton Loading Card */
.studio-generation-skeleton {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  border-radius: var(--radius-md);
  aspect-ratio: 3 / 4;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.studio-generation-skeleton::before {
  content: '';
  position: absolute;
  inset: -50%;
  z-index: -1;
  background: radial-gradient(ellipse at 30% 35%, var(--primary-glow), transparent 55%),
    linear-gradient(115deg, transparent 30%, var(--border-color) 50%, transparent 70%);
  animation: studio-generation-drift 4s ease-in-out infinite alternate;
}

.studio-generation-sparkle { width: 28px; height: 28px; flex-shrink: 0; color: var(--primary); animation: studio-generation-breathe 2.4s ease-in-out infinite; }
.studio-generation-skeleton .studio-skeleton-label { text-align: center; line-height: 1.4; }
.studio-skeleton-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

@keyframes studio-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes studio-generation-drift {
  from { transform: translate(-12%, -8%) rotate(-10deg); }
  to { transform: translate(12%, 8%) rotate(10deg); }
}
@keyframes studio-generation-breathe {
  0%, 100% { opacity: .55; transform: scale(.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  .studio-generation-skeleton::before, .studio-generation-sparkle { animation: none; }
}

/* ==========================================================================
   Frame Inspector / Editor Responsive Layout (Modal on Desktop, Bottom Sheet on Mobile)
   ========================================================================== */

.studio-editor-modal .studio-editor-content {
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  padding: 0;
  overflow: hidden;
}

.studio-editor-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  height: 100%;
  max-height: 85vh;
}

.studio-editor-canvas-pane {
  display: flex;
  flex-direction: column;
  background: #000;
  position: relative;
  min-height: 400px;
}

.studio-editor-canvas-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 16px;
}

.studio-editor-img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.studio-editor-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #fff;
  z-index: 10;
}

.studio-editor-variants-bar {
  background: rgba(20, 20, 20, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.studio-editor-subheading {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.studio-editor-variants-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.studio-variant-btn,
.studio-editor-variants-bar .secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none !important;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.2;
  box-sizing: border-box;
}

.studio-variant-btn svg,
.studio-variant-btn i,
.studio-editor-variants-bar .secondary-btn svg,
.studio-editor-variants-bar .secondary-btn i {
  width: 14px;
  height: 14px;
  margin: 0 !important;
  flex-shrink: 0;
}

.studio-variant-btn:active,
.studio-editor-variants-bar .secondary-btn:active {
  transform: scale(0.97);
}

/* "Скачать" secondary button */
.studio-variant-btn-secondary,
.studio-editor-variants-bar #studio-download-variant-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.studio-variant-btn-secondary:hover,
.studio-editor-variants-bar #studio-download-variant-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.3);
  text-decoration: none !important;
}

/* "Сделать текущей" primary action button */
.studio-variant-btn-primary,
.studio-editor-variants-bar #studio-set-current-variant-btn {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #ffffff !important;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.studio-variant-btn-primary:hover,
.studio-editor-variants-bar #studio-set-current-variant-btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff !important;
}

.studio-editor-variants-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.studio-variant-chip {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.studio-variant-chip:hover {
  background: rgba(255, 255, 255, 0.2);
}

.studio-variant-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.studio-editor-side-pane {
  padding: 24px 20px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.studio-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 32px;
}

.studio-editor-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.studio-style-toggle-bar { display: flex; justify-content: center; padding: 0 14px 12px; background: #000; }
.studio-style-toggle-bar .studio-variant-btn:disabled { opacity: .58; cursor: default; }
.studio-series-hint { display: flex; align-items: center; gap: 9px; margin: 0; padding: 8px; border-left: 3px solid var(--primary); border-radius: 8px; background: var(--bg-panel); color: var(--text-secondary); }
.studio-series-hint-thumb { width: 34px; height: 42px; flex: 0 0 34px; border: 1px solid var(--border-color); border-radius: 5px; object-fit: cover; background: var(--bg-secondary); }
.studio-series-hint-copy { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.3; }
.studio-series-hint-copy strong { color: var(--text-primary); font-size: .76rem; }
.studio-series-hint-copy small { color: var(--text-secondary); font-size: .68rem; }
.studio-series-hint.is-disabled .studio-series-hint-thumb { opacity: .58; }

.studio-intent-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--primary-glow);
  color: var(--primary);
}

.studio-editor-tabs-nav {
  display: flex;
  background: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
}

.studio-editor-tab-btn {
  flex: 1;
  text-align: center;
  padding: 8px 10px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.studio-editor-tab-btn.active {
  background: var(--bg-panel);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.studio-editor-tab-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.studio-tab-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.studio-action-cta {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Responsive Bottom Sheet Adaptation for Mobile */
@media screen and (max-width: 768px) {
  .studio-editor-modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .studio-editor-modal .studio-editor-content {
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    min-height: 0;
    max-height: 92vh !important;
    max-height: 92dvh !important;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  .studio-editor-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .studio-editor-canvas-pane {
    min-height: 0;
    flex: 0 0 auto;
  }

  .studio-editor-canvas-wrapper {
    flex: 0 0 auto;
    min-height: 280px;
  }

  .studio-editor-img {
    max-height: 40vh;
    max-height: 40dvh;
  }

  .studio-editor-side-pane {
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding: 18px 16px;
    overflow: visible;
    overscroll-behavior: auto;
  }

  .studio-editor-modal .lightbox-close-btn {
    position: sticky;
    top: 8px;
    align-self: flex-end;
    margin: 8px 8px -52px 0;
  }

  .studio-workspace {
    padding: 12px 14px 32px;
  }

  .studio-presets-grid {
    grid-auto-flow: column;
    grid-auto-columns: clamp(136px, 36vw, 164px);
    grid-template-columns: none;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
}

/* Model indicator watermark for test comparison */
.studio-editor-model-watermark {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.studio-frame-model-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  pointer-events: none;
  z-index: 3;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  max-width: calc(100% - 12px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}



/* Keep editor controls above home indicators and on-screen keyboard insets. */
@media screen and (max-width: 768px) {
  .studio-editor-side-pane { padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
  .studio-editor-content { overscroll-behavior-y: contain; }
}

/* Shared product editor uses the existing paid generation pipeline. */
.studio-mode-toggle { flex-wrap: wrap; max-width: 100%; }
.studio-card-v2 { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.studio-v2-block { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.studio-v2-block .studio-field-header { gap: 8px; flex-wrap: wrap; }
.studio-v2-copy-actions { display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; }
.studio-v2-copy-actions .studio-scene-idea-btn { min-width: 0; padding-inline: 12px; }
.studio-v2-copy-actions .studio-scene-idea-btn svg { flex-shrink: 0; }
.studio-v2-copy-actions > .studio-hint { min-width: 0; flex: 0 1 auto; }
.studio-v2-copy-actions .secondary-btn { padding: 8px 12px; font-size: .85rem; }
.studio-v2-error { margin: 0; color: var(--error, #d64040); font-size: .85rem; }
.studio-v2-settings { display: flex; flex-direction: column; gap: 18px; }
.studio-v2-active .studio-action-row { justify-content: flex-end; }
.studio-v2-active .studio-primary-cta { width: 100%; }
@media (max-width: 540px) {
  .studio-mode-btn { padding: 9px 10px; }
  .studio-v2-copy-actions button { min-height: 44px; }
}
.studio-v2-options { display: flex; flex-direction: column; gap: 2px; }
.studio-v2-switch { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 64px; padding: 8px 0; cursor: pointer; }
.studio-v2-switch > span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.studio-v2-switch strong { color: var(--text-primary); font-size: .9rem; font-weight: 600; }
.studio-v2-switch small { color: var(--text-secondary); font-size: .78rem; line-height: 1.4; }
.studio-v2-switch input { appearance: none; -webkit-appearance: none; flex-shrink: 0; width: 44px; height: 26px; padding: 3px; margin: 0; border: 1px solid var(--border-color); border-radius: 16px; background: var(--bg-secondary); cursor: pointer; transition: background .15s; }
.studio-v2-switch input::before { content: ''; display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--text-secondary); transition: transform .15s; }
.studio-v2-switch input:checked { background: var(--primary); border-color: var(--primary); }
.studio-v2-switch input:checked::before { background: white; transform: translateX(18px); }
.studio-v2-switch input:disabled { opacity: .45; cursor: default; }
.studio-v2-switch:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 6px; }
@media (max-width: 540px) {
  .studio-v2-switch { min-height: 64px; }
  .studio-v2-options { gap: 0; }
}
@media (prefers-reduced-motion: reduce) { .studio-v2-switch input, .studio-v2-switch input::before { transition: none; } }
/* Keep the reference library scrollable instead of compressing all 35 cards. */
.studio-examples-content { max-height: 88dvh; overflow: hidden; }
.studio-examples-header { flex: 0 0 auto; }
.studio-examples-grid { min-height: 0; grid-auto-rows: max-content; align-content: start; overscroll-behavior: contain; }
.studio-example-card { align-self: start; }
.studio-example-thumb-wrap, .studio-example-info { flex-shrink: 0; }
@media (max-width: 540px) {
  .studio-examples-modal { padding: 12px; }
  .studio-examples-content { padding: 16px; max-height: 90dvh; }
  .studio-examples-title { font-size: 1.05rem; }
  .studio-examples-title-row { gap: 7px; }
  .studio-examples-title-row > i, .studio-examples-title-row > svg { display: none; }
  .studio-examples-subtitle { font-size: .8rem; }
  .studio-examples-grid { max-height: none; overflow-y: auto; }
  .studio-examples-content .lightbox-close-btn { width: 40px; height: 40px; top: 8px; right: 8px; }
}
@media (max-width: 540px) {
  .studio-v2-active .studio-product-title-input,
  .studio-v2-active .studio-input,
  .studio-v2-active .studio-select,
  .studio-v2-active .studio-textarea { font-size: 16px; }
  .studio-v2-active .studio-format-btn,
  .studio-examples-content .lightbox-close-btn { min-width: 44px; min-height: 44px; }
}
@media (max-width: 640px) {
  /* Nine formats would take several rows; scroll them in one line instead. */
  .studio-format-selector { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding: 0 2px 4px; scrollbar-width: thin; overscroll-behavior-x: contain; }
  .studio-format-btn { flex: none; min-height: 44px; }
  .studio-format-scroll.has-more-formats::after { content: ''; position: absolute; top: 0; bottom: 4px; right: 0; width: 72px; background: linear-gradient(to right, transparent, var(--bg-card) 65%); pointer-events: none; }
  .studio-format-next { display: inline-flex; position: absolute; top: 0; right: 0; z-index: 1; width: 44px; height: 44px; align-items: center; justify-content: center; border: 1px solid var(--border-color); border-radius: 50%; background: var(--bg-panel); color: var(--text-primary); cursor: pointer; }
  .studio-format-next svg { width: 18px; height: 18px; }
  .studio-format-next:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
}

/* Card setup: product presentation, visual style, then editable copy. */
.studio-v2-step { padding: 18px 0; border-bottom: 1px solid var(--border-color); gap: 8px; }
.studio-v2-step:first-child { padding-top: 0; }
.studio-v2-step-heading { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.studio-v2-step-heading h3 { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.4; }
.studio-frame-design-tag { color: var(--text-secondary); font-size: .72rem; }
.studio-v2-step > .studio-hint, .studio-v2-presentation-fields > .studio-hint { margin: 0; line-height: 1.5; }
.studio-v2-presentation-fields, .studio-v2-reference-fields { display: flex; flex-direction: column; gap: 12px; }
.studio-v2-presentation-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.studio-v2-preset { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-panel); color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; scroll-snap-align: start; }
.studio-v2-preset img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px 9px 0 0; background: var(--bg-secondary); }
.studio-v2-preset span { display: block; padding: 10px; font-size: .8rem; line-height: 1.35; font-weight: 500; overflow-wrap: anywhere; }
.studio-v2-preset[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.studio-v2-preset[aria-pressed="true"] span { color: var(--primary); }
.studio-v2-preset:hover { border-color: var(--primary); }
.studio-v2-preset:focus-visible, .studio-v2-reference-action:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.studio-v2-preset:disabled, .studio-v2-reference-action:disabled { opacity: .5; cursor: default; }
/* Two reference sources share one stable layout, including saved series designs. */
.studio-v2-reference-sources { display: grid; grid-template-columns: minmax(0, .78fr) 28px minmax(0, 1.5fr); gap: 14px; align-items: stretch; }
.studio-v2-reference-source { display: flex; min-width: 0; }
.studio-v2-reference-upload, .studio-v2-reference-picker, .studio-v2-reference-selected { box-sizing: border-box; min-width: 0; border: 1px solid var(--border-color); border-radius: 14px; background: var(--bg-panel); }
.studio-v2-reference-upload { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 300px; padding: 24px; border-style: dashed; color: var(--text-primary); font: inherit; text-align: center; cursor: pointer; }
.studio-v2-reference-upload small { color: var(--text-secondary); line-height: 1.5; }
.studio-v2-reference-upload:hover { border-color: var(--primary); }
.studio-v2-reference-upload:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.studio-v2-reference-upload:disabled { opacity: .5; cursor: default; }
.studio-v2-reference-picker { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.studio-v2-reference-options { display: flex; flex-direction: column; gap: 12px; min-width: 0; flex: 1; }
.studio-v2-reference-grid { display: grid; grid-auto-flow: column; grid-auto-columns: 43%; gap: 8px; min-width: 0; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; padding: 3px 3px 10px; }
.studio-v2-reference-option { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; position: relative; min-width: 0; padding: 4px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-panel); color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; scroll-snap-align: start; }
.studio-v2-reference-option img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: var(--bg-secondary); border-radius: 6px; }
.studio-v2-reference-option[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.studio-v2-reference-option:hover { border-color: var(--primary); }
.studio-v2-reference-option:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.studio-v2-reference-option:disabled { opacity: .5; cursor: default; }
.studio-v2-reference-options > [data-v2-all] { width: 100%; margin-top: auto; }
.studio-v2-reference-selected { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 12px; width: 100%; padding: 16px; }
.studio-v2-reference-clear { position: absolute; top: 20px; right: 20px; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border-color); border-radius: 50%; background: var(--bg-panel); color: var(--text-primary); cursor: pointer; }
.studio-v2-reference-clear:hover { border-color: var(--primary); background: var(--bg-secondary); }
.studio-v2-reference-clear:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.studio-v2-reference-clear:disabled { opacity: .5; cursor: default; }
.studio-v2-reference-selected > img { display: block; width: min(100%, 240px); aspect-ratio: 3 / 4; height: auto; max-height: 320px; margin-inline: auto; object-fit: contain; border-radius: 8px; background: var(--bg-secondary); }
.studio-v2-reference-selected > span { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.studio-v2-reference-selected strong { font-size: .88rem; font-weight: 600; overflow-wrap: anywhere; }
.studio-v2-reference-selected small { color: var(--text-secondary); font-size: .78rem; line-height: 1.4; }
.studio-v2-presentation-picker { display: flex; flex-direction: column; gap: 10px; }
.studio-v2-reference-selected > button { min-height: 44px; }
.studio-v2-reference-action { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 14px; border: 1px solid var(--border-color); border-radius: 9px; background: var(--bg-panel); color: var(--text-primary); font: inherit; font-size: .85rem; cursor: pointer; }
.studio-v2-reference-action svg { flex: none; }
.studio-v2-reference-action:hover { border-color: var(--primary); background: var(--bg-secondary); }
.studio-example-selected { position: absolute; bottom: 8px; left: 8px; border-radius: 20px; padding: 5px 9px; background: var(--primary); color: white; font-size: .72rem; font-weight: 600; }
@media (min-width: 641px) {
  .studio-v2-presentation-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9.6px; }
  .studio-v2-reference-upload { min-height: 220px; }
  .studio-v2-reference-grid { grid-auto-columns: 21.5%; }
}
@media (max-width: 640px) {
  .studio-v2-presentation-grid {
    grid-auto-flow: column;
    grid-auto-columns: clamp(136px, 36vw, 164px);
    grid-template-columns: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 2px 3px 8px;
  }
  .studio-v2-step-heading h3 { font-size: .94rem; }
  .studio-v2-reference-sources { grid-template-columns: minmax(0, 1fr); }
  .studio-v2-reference-upload { min-height: 180px; }
  .studio-v2-reference-grid { grid-auto-columns: 46%; }

}

/* Keep result controls comfortable to tap, including narrow phone screens. */
@media (max-width: 768px) {
  .studio-editor-modal .lightbox-close-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .studio-editor-canvas-pane, .studio-editor-side-pane { min-width: 0; }
  .studio-editor-variants-header { flex-wrap: wrap; gap: 8px; }
  .studio-editor-variants-actions { flex-wrap: wrap; max-width: 100%; }
  .studio-editor-modal .studio-variant-btn,
  .studio-editor-modal .studio-variant-chip,
  .studio-editor-modal .studio-editor-tab-btn,
  .studio-editor-modal .studio-select,
  .studio-editor-modal .studio-action-cta { min-height: 44px; }
  .studio-editor-modal .studio-variant-chip { min-width: 44px; }
  .studio-editor-modal .studio-textarea,
  .studio-editor-modal .studio-select { font-size: 16px; }
  .studio-editor-side-pane { overscroll-behavior: auto; }
}

.studio-v2-setting { min-width: 0; }
.studio-v2-setting + .studio-v2-setting { margin-top: 16px; padding-top: 8px; border-top: 1px solid var(--border-color); }
.studio-v2-setting-fields { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.studio-v2-setting-fields textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 96px; line-height: 1.5; }
.studio-v2-setting-fields button { min-height: 44px; }

/* Preserve readable scene choices when the app lives in a narrow desktop panel. */
@container (max-width: 700px) {
  .studio-v2-presentation-grid { grid-auto-flow: column; grid-auto-columns: 144px; grid-template-columns: none; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 3px 8px; }
  .studio-v2-reference-sources { grid-template-columns: minmax(0, 1fr); }
}
.studio-v2-reference-sources:has(.studio-v2-reference-picker.hidden) { grid-template-columns: minmax(0, 1fr); }

/* The same limit notice as other chats, outside the hideable Studio composer. */
.studio-composer-notice-slot { flex-shrink: 0; width: 100%; max-width: 712px; margin: 0 auto 8px; }
.studio-composer-notice-slot .chat-composer-notice { box-sizing: border-box; }
/* Invitation in historical image chats. */
.studio-legacy-banner { display: flex; align-items: center; gap: 20px; padding: 16px 20px; margin: 12px 24px 0; border: 1px solid var(--border-color); border-radius: 16px; background: var(--bg-surface); }
.studio-legacy-banner strong { font-size: 15px; }
.studio-legacy-banner p { margin: 4px 0 0; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.studio-legacy-banner a { flex-shrink: 0; text-decoration: none; padding: 10px 18px; border-radius: 12px; }
@media (max-width: 600px) {
  .studio-legacy-banner { margin: 8px 12px 0; padding: 12px; gap: 12px; }
  .studio-legacy-banner p { font-size: 12px; }
  .studio-legacy-banner a { padding: 10px 12px; font-size: 13px; }
}
.studio-legacy-banner[hidden], .studio-format-btn[hidden] { display: none; }

/* Product editor. */
.studio-product-editor .studio-card-v2 { gap: 26px; }
.studio-product-editor .studio-v2-step { padding: 0; border-bottom: 0; gap: 16px; }
.studio-product-editor .studio-v2-step-heading h3 { font-size: 1.05rem; line-height: 1.4; }
.studio-product-editor .studio-v2-switch small { display: none; }
.studio-product-editor .studio-editor-design-choices { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.studio-editor-design-choices button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; min-height: 84px; padding: 14px 8px; border: 1px solid var(--border-color); border-radius: 14px; background: var(--bg-panel); color: var(--text-primary); font: inherit; font-size: .85rem; cursor: pointer; }
.studio-editor-design-choices button > svg { width: 18px; height: 18px; }
.studio-editor-design-choices button[aria-pressed="true"] { color: var(--primary); border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--bg-panel)); box-shadow: 0 0 0 1px var(--primary); }
.studio-editor-design-choices button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.studio-editor-design-choices button:disabled { opacity: .5; cursor: default; }
.studio-product-editor .studio-v2-reference-sources { grid-template-columns: minmax(0,1fr); gap: 12px; }
.studio-product-editor .studio-v2-reference-picker { padding: 0; border: 0; border-radius: 0; background: transparent; }
.studio-product-editor .studio-v2-reference-grid { grid-auto-columns: calc((100% - 40px) / 4.4); gap: 10px; }
.studio-product-editor .studio-v2-reference-selected { display: grid; grid-template-columns: 64px minmax(0,1fr) 44px; align-items: center; column-gap: 12px; padding: 12px; }
.studio-product-editor .studio-v2-reference-selected > img { grid-column: 1; grid-row: 1 / 3; width: 64px; max-height: 86px; }
.studio-product-editor .studio-v2-reference-selected > span { grid-column: 2; grid-row: 1; padding-right: 0; }
.studio-product-editor .studio-v2-reference-selected-upload { grid-column: 2; grid-row: 2; }
.studio-product-editor .studio-editor-apply-style { grid-column: 2; grid-row: 2; }
.studio-product-editor[data-editor-design="auto"] [data-v2-reference-selected-upload] { display: none; }
.studio-product-editor .studio-v2-reference-selected > .studio-v2-reference-clear { position: static; grid-column: 3; grid-row: 1 / 3; }
.studio-product-editor[data-editor-design="library"] [data-v2-reference-selected-upload] { display: none; }
.studio-product-editor .studio-v2-reference-upload { min-height: 170px; }
.studio-product-editor .studio-v2-options { gap: 0; }
.studio-product-editor .studio-v2-setting { position: relative; padding: 0; border-top: 1px solid var(--border-color); }
.studio-product-editor .studio-v2-setting + .studio-v2-setting { margin-top: 18px; padding-top: 0; }
.studio-product-editor .studio-v2-switch { min-height: 58px; gap: 12px; padding: 12px 64px 12px 0; }
.studio-product-editor .studio-v2-switch strong,
.studio-product-editor #studio-prompt-field .studio-field-label { font-size: .85rem; font-weight: 600; }
.studio-product-editor .studio-v2-switch > input { position: absolute; right: 0; top: 16px; }
.studio-product-editor .studio-v2-settings { gap: 18px; }
.studio-product-editor .studio-product-meta-fields > .studio-category-select-wrapper { min-width: 0; }
/* Product photos and editable metadata share one quiet surface. */
.studio-product-editor .studio-source-section { padding: 16px; gap: 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-card); }
.studio-product-editor .studio-source-section .studio-section-header { flex-direction: column; align-items: flex-start; gap: 4px; }
.studio-product-editor #studio-sources-count { background: var(--bg-panel); color: var(--text-secondary); font-weight: 500; }
.studio-product-editor #studio-sources-count::after { content: ' фото'; }
.studio-product-editor .studio-source-strip { gap: 10px; padding: 2px 0 6px; }
.studio-product-editor .studio-source-card,
.studio-product-editor .studio-source-pending,
.studio-product-editor .studio-add-source-btn { width: 168px; height: 168px; min-width: 168px; border-radius: 12px; }
.studio-product-editor .studio-add-source-btn { background: var(--bg-panel); border-width: 1px; }
.studio-product-editor .studio-source-card.is-primary { box-shadow: none; }
.studio-product-editor .studio-product-title-row { padding: 0; margin-top: 0; border: 0; border-radius: 0; background: transparent; }
.studio-product-editor .studio-product-title-label { display: none; }
.studio-product-editor .studio-product-meta-fields { flex-direction: row; flex-wrap: wrap; align-items: start; gap: 8px; }
/* Match native-control metrics across desktop browsers and iOS Safari. */
.studio-product-editor .studio-product-title-input-wrapper,
.studio-product-editor .studio-category-select-wrapper select.studio-category-select { height: 44px; min-height: 44px; }
.studio-product-editor .studio-product-title-input-wrapper { flex: 0 1 26rem; min-width: 0; padding: 8px 12px; border-color: var(--border-color); border-radius: 12px; background: var(--bg-panel); }
.studio-product-editor .studio-product-title-input { min-width: 0; min-height: 0; padding: 0; line-height: 24px; -webkit-appearance: none; appearance: none; font-size: .9rem; }
.studio-product-editor .studio-product-title-input-wrapper:focus-within { border-color: var(--primary); }
.studio-product-editor .studio-product-meta-fields > .studio-category-select-wrapper { flex: 0 1 20rem; width: auto; }
.studio-product-editor .studio-category-select-wrapper::after { content: ''; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--text-primary); border-bottom: 2px solid var(--text-primary); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.studio-product-editor .studio-category-select-wrapper select.studio-category-select { display: block; -webkit-appearance: none; appearance: none; padding: 8px 36px 8px 12px; line-height: 24px; border-color: var(--border-color); border-radius: 12px; background: var(--bg-panel); font-size: .85rem; }
.studio-product-editor .studio-category-select-wrapper select.studio-category-select:focus { border-color: var(--primary); }
@container (max-width: 700px) {
  .studio-product-editor .studio-v2-reference-grid { grid-auto-columns: 43%; }
}
@media (max-width: 640px) {
  .studio-product-editor .studio-editor-design-choices { gap: 8px; }
  .studio-editor-design-choices button { min-height: 80px; padding: 12px 4px; }
  .studio-product-editor .studio-v2-reference-grid { grid-auto-columns: 43%; }
  .studio-product-editor .studio-v2-switch { padding-right: 56px; }
  .studio-product-editor .studio-v2-reference-selected { grid-template-columns: 52px minmax(0,1fr) 44px; gap: 8px; }
  .studio-product-editor .studio-v2-reference-selected > img { width: 52px; }
  .studio-product-editor .studio-source-section { padding: 14px; }
  .studio-product-editor .studio-product-title-input-wrapper,
  .studio-product-editor .studio-product-meta-fields > .studio-category-select-wrapper { flex-basis: 100%; width: 100%; }
  .studio-product-editor .studio-product-title-input,
  .studio-product-editor .studio-category-select-wrapper select.studio-category-select { font-size: 16px; }
  .studio-product-editor .studio-product-title-loader { white-space: normal; font-size: .75rem; }
}

/* Public AI Studio chat: finished cards only */
.public-studio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  align-items: start;
  gap: 16px;
  box-sizing: border-box;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

/* Same lift on hover as the owner's frame cards (.studio-frame-card). */
.public-studio-card {
  margin: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.public-studio-card:hover,
.public-studio-card:focus-within {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.public-studio-card-preview {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  cursor: zoom-in;
}

.public-studio-card-preview:focus-visible {
  outline: none;
}

.public-studio-card-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: .75rem;
  font-weight: 500;
}

.public-studio-card-badge svg {
  width: 12px;
  height: 12px;
}

.public-studio-card-preview img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: contain;
}

@media (max-width: 600px) {
  .public-studio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

/* Studio owns edit fields; the reusable viewer owns the surrounding modal. */
.image-viewer-edit-panel .studio-editor-side-pane { padding: 0; border: 0; overflow: visible; background: transparent; }
.image-viewer-edit-panel .studio-editor-tabs-nav { margin: 4px 0; }
.image-viewer-edit-panel .studio-editor-tab-btn { min-height: 44px; min-width: 0; padding: 8px 4px; font-size: .78rem; }
.image-viewer-edit-panel .studio-action-cta { min-height: 48px; }
.generation-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}
.generation-feedback .msg-action-btn { width: auto; padding: 5px 9px; }
.generation-feedback button[aria-pressed="true"] { color: var(--text-primary); outline: 1px solid currentColor; }
.generation-feedback-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* A block, so an open note does not widen the message to fit beside the buttons. */
.generation-feedback-result { display: block; }
.generation-feedback-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.generation-feedback-row[hidden],
.generation-feedback-form[hidden] { display: none; }
.generation-feedback-form textarea {
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  resize: vertical;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input, var(--bg-panel));
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
}
.generation-feedback-form textarea:focus { outline: none; border-color: var(--primary); }
/* iOS zooms into fields under 16px. */
@media (max-width: 768px) { .generation-feedback-form textarea { font-size: 16px; } }
.generation-feedback-actions { display: flex; gap: 8px; }
.generation-feedback-actions button, .generation-feedback-fix button {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.generation-feedback-actions .generation-feedback-send, .generation-feedback-fix .generation-feedback-send { background: var(--primary); border-color: var(--primary); color: #fff; }
.generation-feedback-actions button:disabled, .generation-feedback-fix button:disabled { opacity: .6; cursor: default; }

/* «Тренды» и «Шаблоны» of the image generator */
.image-templates {
  width: 100%;
  max-width: 920px;
  margin-top: 10px;
  padding: 0 16px;
  box-sizing: border-box;
}

.image-templates-tabs {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 14px;
}

.image-templates-tab {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font: 600 14px/1.2 var(--font-family);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.image-templates-tab.active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg-main);
}

.image-templates-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.image-template-card {
  position: relative;
  aspect-ratio: 4 / 5;
  border: none;
  border-radius: var(--radius-md);
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  background: var(--bg-card);
  text-align: left;
  font-family: var(--font-family);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.image-template-card:hover,
.image-template-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.image-template-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-template-card-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 28px 12px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  color: #fff;
}

.image-template-card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.image-template-card-hint {
  font-size: 12px;
  opacity: 0.8;
}

.image-template-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.image-template-tile {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.image-template-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(10, 10, 11, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeIn var(--transition-fast) ease-out;
}

.image-template-window {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 940px;
  height: min(640px, calc(100vh - 48px));
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-panel);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
  animation: scaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

body.dark-theme .image-template-window {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.image-template-cover {
  flex: 1.2;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0b;
}

.image-template-cover img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.image-template-body {
  width: 400px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-family);
}

.image-template-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.image-template-scroll h3 {
  margin: 0;
  padding-right: 32px;
  font-size: 22px;
  line-height: 1.25;
}

.image-template-desc {
  margin: -10px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.image-template-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
}

.image-template-photo-add {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border: 1.5px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font: 600 14px var(--font-family);
  cursor: pointer;
}

.image-template-photo-add.missing,
.image-template-field.missing input,
.image-template-field.missing textarea {
  border-color: var(--danger);
}

.image-template-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.image-template-hint.missing {
  color: var(--danger);
}

.image-template-photo-preview {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.image-template-photo-preview img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
}

.image-template-photo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-size: 14px;
}

.image-template-photo-change,
.image-template-wishes-open {
  border: none;
  padding: 0;
  background: none;
  color: var(--primary);
  font: 600 13px var(--font-family);
  cursor: pointer;
}

.image-template-wishes-open {
  align-self: flex-start;
}

.image-template-photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel);
  color: var(--text-secondary);
  cursor: pointer;
}

.image-template-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.image-template-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-template-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.image-template-optional {
  font-weight: 400;
  color: var(--text-muted);
}

.image-template-field input,
.image-template-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: 15px/1.4 var(--font-family);
  resize: vertical;
}

.image-template-field input:focus,
.image-template-field textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

.image-template-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.image-template-chip {
  padding: 7px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-primary);
  font: 500 13px var(--font-family);
  cursor: pointer;
}

.image-template-chip.active {
  border-color: var(--primary);
  background: var(--primary-glow);
  color: var(--primary);
}

.image-template-footer {
  display: flex;
  align-items: center;
  padding: 14px 28px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-color);
  background: var(--bg-panel);
}

.image-template-create {
  flex: 1;
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font: 600 15px var(--font-family);
  cursor: pointer;
}

.image-template-create:hover {
  background: var(--primary-hover);
}

.image-template-followup {
  display: inline-flex;
  margin-top: 10px;
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-primary);
  font: 600 13px var(--font-family);
  cursor: pointer;
}

@media (max-width: 768px) {
  .image-templates-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .image-template-card-title {
    font-size: 13px;
  }

  .image-template-overlay {
    padding: 0;
    align-items: stretch;
  }

  .image-template-window {
    flex-direction: column;
    max-width: none;
    height: 100%;
    height: 100dvh;
    border-radius: 0;
  }

  .image-template-cover {
    flex: 0 0 auto;
    height: 35vh;
    height: 35dvh;
  }

  .image-template-body {
    width: 100%;
    flex: 1;
    min-height: 0;
    border-left: none;
  }

  .image-template-scroll {
    padding: 20px 16px 12px;
  }

  .image-template-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .image-template-close {
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
  }
}

.popover-muza-unlimited {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Sign-in with Yandex ID and VK ID (decision 2026-11-12): the provider's colours and wording, unchanged. */
/* Sign-in window, first screen (decision 2026-11-12, variant Б): services, «или», «Войти по почте»,
   one line with the documents. Colours follow the theme: the e-mail button is the text colour. */
.auth-start { display: flex; flex-direction: column; gap: 12px; }
.auth-start[hidden], .auth-provider-btn[hidden], .auth-back-btn[hidden], .auth-legal[hidden] { display: none; }
.auth-provider-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 52px; padding: 12px 18px;
  border: 1px solid var(--border-color); border-radius: 999px;
  background: var(--bg-card); color: var(--text-primary);
  font-size: 1.02rem; font-weight: 500; cursor: pointer;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
}
.auth-provider-btn:hover { background: var(--bg-sidebar); }
.auth-provider-btn:active, .auth-email-btn:active { transform: scale(0.99); }
.auth-provider-btn:disabled { opacity: 0.6; cursor: wait; }
.auth-provider-logo { width: 22px; height: 22px; flex-shrink: 0; }
.auth-start-divider {
  display: flex; align-items: center; gap: 14px; margin: 6px 0;
  color: var(--text-secondary); font-size: 0.9rem;
}
.auth-start-divider::before, .auth-start-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }
/* Light blue, as calm as the Yandex button: the person picks the way (2026-11-12). */
.auth-email-btn {
  width: 100%; min-height: 54px; padding: 14px 18px; border: 1px solid rgba(10, 124, 255, 0.18); border-radius: 999px;
  background: rgba(10, 124, 255, 0.1); color: #0063d1;
  font-size: 1.05rem; font-weight: 600; cursor: pointer; transition: background 0.2s, transform 0.1s;
}
.auth-email-btn:hover { background: rgba(10, 124, 255, 0.16); }
body.dark-theme .auth-email-btn { background: rgba(10, 124, 255, 0.18); border-color: rgba(10, 124, 255, 0.3); color: #7ab8ff; }
body.dark-theme .auth-email-btn:hover { background: rgba(10, 124, 255, 0.26); }
/* The other way by e-mail, quiet under the main button (2026-11-12). */
.auth-email-link {
  align-self: center; margin-top: -4px; padding: 4px 8px; border: none; background: transparent; box-shadow: none;
  color: var(--text-secondary); font-size: 0.9rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.auth-email-link:hover { color: var(--text-primary); }
.auth-legal {
  margin: 8px 0 0; text-align: center; color: var(--text-secondary);
  font-size: 0.78rem; line-height: 1.45;
}
.auth-legal a { color: var(--text-secondary); text-decoration: underline; }
.auth-back-btn {
  position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 2px;
  padding: 6px 8px; border: none; background: transparent; box-shadow: none;
  color: var(--text-secondary); font-size: 0.9rem; cursor: pointer;
}
.auth-back-btn svg { width: 18px; height: 18px; }

/* Chat skeletons (2026-11-15): a dialog opening and older messages of a paged chat. */
.chat-loading { padding: 16px 0; }
.chat-skeleton { display: flex; flex-direction: column; gap: 14px; padding: 8px 0; }
.chat-skeleton-bubble { display: flex; flex-direction: column; gap: 8px; max-width: min(78%, 420px); padding: 14px 16px; border-radius: 18px; background: var(--bg-card); }
.chat-skeleton-bubble.is-user { align-self: flex-end; width: 46%; }
.chat-skeleton-bubble.is-assistant { align-self: flex-start; width: 72%; }
.chat-skeleton-bubble span { display: block; height: 11px; border-radius: 6px; background: rgba(127, 127, 127, .16); background: color-mix(in srgb, var(--text-primary) 9%, transparent); animation: chat-skeleton-pulse 1.2s ease-in-out infinite; }
.chat-skeleton-bubble span:nth-child(2) { width: 64%; }
.chat-skeleton-bubble span.is-card { width: 100%; height: 72px; border-radius: 14px; margin-top: 4px; }
.chat-older { padding: 4px 0 10px; }
.chat-older-retry { display: block; margin: 4px auto 8px; min-height: 40px; padding: 8px 18px; border: 1px solid var(--border-color); border-radius: 999px; background: var(--bg-main); color: var(--text-primary); font: inherit; cursor: pointer; }
#chat-history.is-paged { overflow-anchor: none; }
@keyframes chat-skeleton-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .chat-skeleton-bubble span { animation: none; } }

/* ——— «Картинки для Авито» ——— */
.ideas-gallery-grid.avito-examples-grid {
  display: grid !important;
  column-count: initial;
  /* Two per row: big enough to read the cover text (2026-11-19). */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.avito-examples-grid .gallery-image-card { margin-bottom: 0; display: flex; flex-direction: column; }
.avito-card-media { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; }
.avito-card-media > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avito-before-thumb {
  position: absolute;
  left: 8px;
  bottom: 8px;
  width: 34%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  z-index: 2;
}
.avito-before-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avito-before-thumb span {
  position: absolute;
  left: 4px;
  top: 4px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.4;
}
.avito-card-caption {
  display: block;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.avito-examples-grid .gallery-image-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.avito-popup { width: 280px; }
/* The list never runs off a short screen: it scrolls inside instead. */
.avito-popup:not(.hidden) { max-height: calc(100vh - 230px); max-height: calc(100dvh - 230px); overflow-y: auto; overscroll-behavior: contain; }
.avito-options { display: flex; flex-direction: column; gap: 2px; }
.avito-option { align-items: center; }
.avito-option-text { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 1px; }
.avito-option-text small { color: var(--text-secondary); font-size: 0.75rem; font-weight: 400; line-height: 1.3; }
.avito-option .radio-circle { flex-shrink: 0; }
.avito-check {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1.5px solid var(--text-secondary);
  border-radius: 5px;
  position: relative;
}
.avito-option.active .avito-check { background: var(--primary); border-color: var(--primary); }
.avito-option.active .avito-check::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.avito-benefits-note {
  margin: -4px 0 4px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}
.avito-benefits-note.avito-note-alert { color: #d93025; font-weight: 600; }
.avito-sheet-done {
  margin-top: 6px;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.avito-setting.avito-disabled .image-opt-btn { opacity: 0.45; cursor: not-allowed; }

.avito-example-content { max-width: 1040px; position: relative; }
.avito-example-pictures {
  flex: 1.4;
  min-width: 0;
  background: #0a0a0b;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 16px;
}
.avito-example-figure { margin: 0; position: relative; }
.avito-example-figure img {
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  display: block;
  border-radius: 10px;
}
.avito-example-pictures.two .avito-example-figure img { max-height: 270px; }
.avito-example-figure { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.avito-example-figure figcaption {
  order: -1;
  align-self: stretch;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.78rem;
  font-weight: 600;
}
.avito-example-info {
  width: 380px;
  flex-shrink: 0;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  box-sizing: border-box;
  border-left: 1px solid var(--border-color);
}
.avito-example-chips { flex-wrap: wrap; gap: 6px; }
.avito-example-prompt span { font-size: 0.8rem; color: var(--text-secondary); }
.avito-example-prompt p {
  margin: 4px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-sidebar);
  font-size: 0.88rem;
  line-height: 1.45;
}
.avito-example-text-only { justify-content: center; }
.avito-example-note { margin: 0; font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4; }

@media (max-width: 768px) {
  .ideas-gallery-grid.avito-examples-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .avito-example-pictures { flex: none; padding: 10px; }
  .avito-example-pictures.two { flex-direction: row; }
  .avito-example-pictures.two .avito-example-figure { flex: 1; min-width: 0; }
  .avito-example-figure img, .avito-example-pictures.two .avito-example-figure img { max-height: 46vh; }
  .avito-example-info { width: 100%; border-left: none; border-top: 1px solid var(--border-color); padding: 18px; gap: 12px; }
  .avito-popup { width: 100%; }
}
@media (max-width: 480px) {
  .avito-example-pictures.two { flex-direction: column; }
  .avito-example-pictures.two .avito-example-figure img { max-height: 30vh; }
  .avito-card-caption { font-size: 0.78rem; padding: 6px 8px; }
  .avito-before-thumb { width: 38%; left: 6px; bottom: 6px; border-radius: 6px; }
}

.avito-before-thumb { width: 30%; }
.avito-card-caption { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
@media (max-width: 480px) {
  .avito-before-thumb { width: 32%; }
}
/* «Картинки для Авито»: price on the picture (2026-11-17) */
.avito-price-input {
  width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--border-color);
  border-radius: 10px; background: var(--bg-main); color: var(--text-primary); font: inherit; font-size: 16px; /* 16px: iPhone does not zoom in on focus */
}
.avito-price-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.avito-price-input:disabled { opacity: 0.5; }
.avito-price-note { margin: 6px 2px 2px; font-size: 0.75rem; color: var(--text-secondary); line-height: 1.35; }
#avito-price-container .avito-chip-val { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* «Картинки для Авито» on phones: every chip in view, wrapped onto new lines (user, 2026-11-17). */
/* Folded (until the composer is tapped): one row — the first chip and «+5». Unfolded: every chip. */
.avito-setting.avito-more { display: none !important; }
@media (max-width: 600px) {
  body.avito-settings-on.avito-expanded .chat-options-row { flex-wrap: wrap !important; overflow-x: visible; row-gap: 6px; }
  body.avito-settings-on.avito-expanded div:has(> .chat-options-row) { align-items: flex-end !important; }
  body.avito-settings-on:not(.avito-expanded) .chat-options-row { flex-wrap: nowrap !important; overflow: hidden; }
  body.avito-settings-on:not(.avito-expanded) .image-options > .format-dropdown-container:not(#avito-scenario-container) { display: none !important; }
  body.avito-settings-on:not(.avito-expanded) #avito-scenario-container { min-width: 0; flex: 0 1 auto; }
  body.avito-settings-on:not(.avito-expanded) #avito-scenario-container .image-opt-btn { max-width: 100%; min-width: 0; overflow: hidden; }
  body.avito-settings-on:not(.avito-expanded) #avito-scenario-container .avito-chip-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.avito-settings-on:not(.avito-expanded) .avito-setting.avito-more { display: inline-flex !important; flex-shrink: 0; font-weight: 600; color: var(--primary); }
}
/* «Картинки для Авито»: example tabs above the gallery (2026-11-19). */
/* Sticks to the top of the chat while scrolling, so the chosen tab stays visible. */
.avito-example-tabs {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 0 auto 6px; width: 100%; max-width: 900px; box-sizing: border-box;
  position: sticky; top: 0; z-index: 6; background: var(--bg-main); padding: 10px 0;
  transition: box-shadow 0.2s ease;
}
.avito-example-tabs.stuck { box-shadow: 0 8px 12px -10px rgba(0, 0, 0, 0.35); }
.avito-example-tab {
  border: 1px solid var(--border-color); background: var(--bg-panel); color: var(--text-secondary);
  border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 0.86rem; cursor: pointer; white-space: nowrap;
}
.avito-example-tab:hover { color: var(--text-primary); }
.avito-example-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (max-width: 600px) {
  .avito-example-tabs { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding: 8px 2px; scrollbar-width: none; }
  .avito-example-tabs::-webkit-scrollbar { display: none; }
}

/* «Карточка для Авито»: 4:3 is Avito's own photo format — said in the format list there only. */
.format-avito-note { display: none; color: var(--text-secondary, #8a8f98); font-weight: 400; }
body.avito-settings-on .format-avito-note { display: inline; }
body.avito-settings-on #format-popup { width: auto; min-width: 220px; }
body.avito-settings-on #format-popup .format-option > span:nth-child(2) { white-space: nowrap; margin-right: 12px; }
/* Second button in the example window: a normal button, not a stretched block. */
.avito-example-info .avito-example-secondary { flex: 0 0 auto; width: 100%; min-height: 44px; }

/* --- «Генерация видео» (public/js/video/VideoTool.js) --- */
.video-popup { width: max-content; min-width: 240px; max-width: min(360px, calc(100vw - 32px)); max-height: min(420px, 60vh); overflow-y: auto; bottom: 100%; top: auto; margin-bottom: 8px; }
.video-option-text { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 1px; }
.video-option-text small { color: var(--text-secondary); font-size: 0.75rem; font-weight: 400; line-height: 1.3; white-space: normal; }
.video-option.is-disabled { opacity: 0.45; cursor: not-allowed; }
.video-option-group { padding: 8px 12px 4px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); }
.video-chip .video-chip-val { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-frame-label { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 0; font-size: 10px; font-weight: 600; text-align: center; color: #fff; background: rgba(0, 0, 0, 0.55); pointer-events: none; }

.overlay-animate-img-btn { position: absolute; bottom: 8px; left: 8px; display: flex; align-items: center; gap: 6px; padding: 6px 12px; border: none; border-radius: 4px; font-size: 13px; color: #fff; background: rgba(0, 0, 0, 0.6); cursor: pointer; backdrop-filter: blur(4px); transition: background 0.2s; }
.overlay-animate-img-btn:hover { background: rgba(0, 0, 0, 0.8); }

.message-bubble.video-message .msg-text { width: 100%; }
.video-card { display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.video-card[data-aspect="16:9"], .video-card[data-aspect="4:3"] { max-width: 520px; }
.video-player { width: 100%; border-radius: 12px; background: #000; display: block; }
.video-card-meta { font-size: 0.8rem; color: var(--text-secondary); }
.video-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.video-action-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 16px; border: 1px solid var(--border-color); background: var(--bg-secondary, transparent); color: var(--text-primary); font-size: 0.82rem; cursor: pointer; }
.video-action-btn svg { width: 14px; height: 14px; }
.video-action-btn:hover { border-color: var(--text-secondary); }
.video-action-btn:disabled { opacity: 0.6; cursor: progress; }
.video-wait { position: relative; overflow: hidden; border-radius: 12px; border: 1px solid var(--border-color); min-height: 140px; display: flex; align-items: flex-end; }
.video-card[data-aspect="3:4"] .video-wait, .video-card[data-aspect="9:16"] .video-wait { aspect-ratio: 3 / 4; }
.video-wait-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(2px) brightness(0.55); }
.video-wait-body { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px; width: 100%; box-sizing: border-box; }
.video-wait-poster + .video-wait-body { color: #fff; }
.video-wait-text { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; line-height: 1.35; }
.video-wait-text span { opacity: 0.85; }
.video-wait-spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid currentColor; border-right-color: transparent; animation: video-spin 0.9s linear infinite; opacity: 0.8; }
.video-wait-bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.video-wait-bar span { display: block; height: 100%; background: currentColor; transition: width 0.6s ease; }
.video-card-failed { padding: 12px; border-radius: 12px; border: 1px solid var(--border-color); }
.video-failed-text { font-size: 0.9rem; line-height: 1.4; }
@keyframes video-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .video-wait-spinner { animation: none; } }
@media (max-width: 600px) {
  .video-popup { max-width: none; width: 100% !important; }
  .video-card { max-width: 100%; }
  .overlay-animate-img-btn span { display: none; }
  .video-chip .video-chip-val { max-width: 120px; }
}

/* «Генерация видео»: example clip on a template card */
.video-templates-grid .gallery-card-hover-overlay { z-index: 2; background: linear-gradient(to top, rgba(13, 13, 13, 0.78) 0%, rgba(13, 13, 13, 0.25) 45%, rgba(13, 13, 13, 0) 70%); }
.video-templates-grid .gallery-card-hover-btn,
.video-templates-grid .gallery-image-card:hover .gallery-card-hover-btn { position: static; transform: none; align-self: flex-start; margin-top: 10px; }
.video-templates-grid .gallery-image-card:hover img { transform: none; }
.video-template-preview {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.gallery-image-card.is-preview-shown .video-template-preview { opacity: 1; }
/* Phones: a small blurred play mark in the corner says «there is a video». */
.video-template-play {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.24);
  -webkit-backdrop-filter: blur(8px) saturate(1.4);
  backdrop-filter: blur(8px) saturate(1.4);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.video-template-play svg { margin-left: 2px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3)); }
@media (hover: hover) and (pointer: fine) {
  .video-template-play { display: none; }
}
/* Phones have no hover: the template name stays on the card, a tap opens the sheet. */
@media (hover: none) {
  .video-templates-grid .gallery-card-hover-overlay,
  .video-templates-grid .gallery-image-card:hover .gallery-card-hover-overlay { opacity: 1; padding: 10px; pointer-events: none; background: linear-gradient(to top, rgba(13, 13, 13, 0.72) 0%, rgba(13, 13, 13, 0) 38%); }
  .video-templates-grid .gallery-card-hover-info,
  .video-templates-grid .gallery-image-card:hover .gallery-card-hover-info { transform: none; }
  .video-templates-grid .gallery-card-hover-info h4 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 0.82rem; line-height: 1.2; }
  .video-templates-grid .gallery-card-hover-info p,
  .video-templates-grid .gallery-card-hover-btn { display: none; }
  .video-templates-grid .gallery-image-card:hover { transform: none; }
}

/* «Генерация видео»: the template window (a dialog; a bottom sheet on phones) */
.vt-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  overscroll-behavior: contain;
  animation: vt-fade 0.18s ease;
}
.vt-modal {
  position: relative;
  display: flex;
  width: min(880px, 100%);
  max-height: min(86vh, 760px);
  overflow: hidden;
  border-radius: 20px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transition: transform 0.22s ease;
}
.vt-modal-grabber { display: none; }
.vt-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--bg-sidebar);
  color: var(--text-primary);
  cursor: pointer;
}
.vt-modal-close:hover { background: var(--border-color); }
.vt-modal-media {
  position: relative;
  flex: 0 0 auto;
  width: min(440px, 52%);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0d0d;
}
.vt-modal-media video,
.vt-modal-media img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(86vh, 760px);
  object-fit: contain;
  cursor: pointer;
}
.vt-modal-toggle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.24);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.vt-modal-toggle svg { margin-left: 3px; }
.vt-modal-overlay.is-paused .vt-modal-toggle { opacity: 1; pointer-events: auto; }
.vt-modal-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 28px 24px;
  overflow-y: auto;
}
.vt-modal-kicker { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.vt-modal-info h3 { margin: 0; padding-right: 32px; font-size: 1.4rem; line-height: 1.25; color: var(--text-primary); }
.vt-modal-desc { margin: 0; color: var(--text-secondary); line-height: 1.45; }
.vt-modal-facts { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.vt-modal-facts li { padding: 5px 10px; border-radius: var(--radius-pill); background: var(--bg-sidebar); color: var(--text-primary); font-size: 0.82rem; line-height: 1.3; white-space: nowrap; }
.vt-modal-hint { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--bg-sidebar); color: var(--text-secondary); font-size: 0.86rem; line-height: 1.4; }
.vt-modal-actions { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.vt-modal-make {
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.vt-modal-make:hover { background: var(--primary-hover); }
.vt-modal-actions small { text-align: center; color: var(--text-secondary); font-size: 0.78rem; }
@keyframes vt-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes vt-sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

@media (max-width: 768px) {
  .vt-modal-overlay { align-items: flex-end; padding: 0; }
  .vt-modal {
    flex-direction: column;
    width: 100%;
    height: 90vh;
    height: 90dvh;
    max-height: none;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    animation: vt-sheet-up 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .vt-modal-grabber {
    display: block;
    position: absolute;
    top: 8px;
    left: 50%;
    z-index: 3;
    width: 40px;
    height: 5px;
    margin-left: -20px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
  .vt-modal-close { top: 14px; right: 12px; background: rgba(0, 0, 0, 0.45); color: #fff; }
  .vt-modal-media { width: 100%; flex: 1 1 auto; min-height: 0; }
  .vt-modal-media video,
  .vt-modal-media img { max-height: none; }
  .vt-modal-info { flex: 0 0 auto; gap: 8px; padding: 14px 16px calc(12px + env(safe-area-inset-bottom)); overflow: visible; }
  .vt-modal-kicker,
  .vt-modal-hint,
  .vt-modal-actions small { display: none; }
  .vt-modal-info h3 { font-size: 1.1rem; padding-right: 0; }
  .vt-modal-desc { font-size: 0.85rem; line-height: 1.35; }
  .vt-modal-facts { margin: 0; }
  .vt-modal-facts li { padding: 4px 9px; font-size: 0.76rem; }
  .vt-modal-actions { padding-top: 2px; }
  .vt-modal-make { padding: 13px 16px; font-size: 0.95rem; }
}

/* «Генерация видео»: thumbnails in the «Что снимаем» list and the large clip beside it */
.video-chip[data-key="template"] .video-popup { min-width: 300px; }
.video-option.has-thumb { gap: 10px; }
.video-option-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 52px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--bg-sidebar);
}
.video-option-thumb img,
.video-option-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-option-thumb video { opacity: 0; transition: opacity 0.15s ease; }
.video-option-thumb.is-shown video { opacity: 1; }
/* Phones: a blurred ▶ in the middle of the picture; a tap on the picture plays it. */
.video-option-thumb.has-clip { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.video-option-thumb-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.26);
  -webkit-backdrop-filter: blur(6px) saturate(1.4);
  backdrop-filter: blur(6px) saturate(1.4);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.video-option-thumb-play svg { width: 12px; height: 12px; margin-left: 2px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3)); }
.video-option-thumb.is-playing .video-option-thumb-play { opacity: 0; }
@media (hover: hover) and (pointer: fine) {
  .video-option-thumb-play { display: none; }
}
@media (hover: none) {
  .video-option-thumb { width: 52px; height: 68px; }
}
.video-peek {
  position: fixed;
  z-index: 9999;
  width: 260px;
  overflow: hidden;
  border-radius: 16px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  animation: vt-fade 0.15s ease;
}
.video-peek video { display: block; width: 100%; max-height: 380px; object-fit: cover; background: #0d0d0d; }
.video-peek-text { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.video-peek-text b { font-size: 0.9rem; color: var(--text-primary); }
.video-peek-text span { font-size: 0.78rem; line-height: 1.35; color: var(--text-secondary); }

/* «Генерация видео»: length list with «Своя длина» */
.video-duration-custom { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; }
.video-duration-custom.active { background: var(--primary-light, rgba(10, 124, 255, 0.08)); }
.video-stepper { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.video-stepper b { min-width: 52px; text-align: center; font-size: 0.9rem; color: var(--text-primary); }
.video-stepper button {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border-color); background: var(--bg-main); color: var(--text-primary);
  font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.video-stepper button:disabled { opacity: 0.35; cursor: default; }

/* «Генерация видео»: «Начало» and «Конец» cells above the message field */
.video-frame-slots { display: none; }
body.video-model-on .video-frame-slots { display: block; padding-bottom: 10px; }
.video-slots { display: flex; align-items: flex-start; gap: 6px; }
.video-slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.video-slot-face {
  width: 64px; height: 64px; padding: 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 12px; border: 1.5px dashed var(--border-color);
  background: var(--bg-sidebar); color: var(--text-secondary); cursor: pointer;
}
.video-slot-face svg { width: 20px; height: 20px; }
.video-slot-face small { font-size: 0.65rem; font-weight: 600; }
.video-slot-face:hover { border-color: var(--primary); color: var(--primary); }
.video-slot.is-filled .video-slot-face { border: 1px solid var(--border-color); }
.video-slot.is-filled img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-slot.is-wanted .video-slot-face { border-color: var(--primary); color: var(--primary); background: var(--primary-light, rgba(10, 124, 255, 0.08)); }
.video-slot.is-loop .video-slot-face { border-style: solid; border-color: var(--primary); color: var(--primary); }
.video-slot.is-off .video-slot-face { opacity: 0.45; }
.video-slot-label { font-size: 0.72rem; color: var(--text-secondary); }
.video-slot-remove {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%; background: rgba(0, 0, 0, 0.65); color: #fff; cursor: pointer;
}
.video-slot-remove svg { width: 12px; height: 12px; }
.video-slot-swap, .video-slot-gap { width: 8px; height: 64px; flex: 0 0 auto; }
.video-slot-swap { width: 20px; }
.video-slot-swap { display: flex; align-items: center; justify-content: center; padding: 0; border: none; background: none; color: var(--text-secondary); cursor: pointer; }
.video-slot-swap svg { width: 16px; height: 16px; }
.video-slot-swap:hover { color: var(--primary); }
.video-slot-end { position: relative; }
.video-slot-menu {
  position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 50; min-width: 230px; padding: 6px;
  border-radius: 14px; background: var(--bg-main); border: 1px solid var(--border-color);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.video-slot-menu.hidden { display: none; }
.video-slot-menu button {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; padding: 10px; text-align: left;
  border: none; border-radius: 10px; background: none; color: var(--text-primary); font-size: 0.9rem; cursor: pointer;
}
.video-slot-menu button:hover { background: var(--bg-sidebar); }
.video-slot-menu button svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--primary); }
.video-slot-menu button span { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
.video-slot-menu small { color: var(--text-secondary); font-size: 0.75rem; }
.video-slots-hint { align-self: center; margin-left: 6px; font-size: 0.78rem; color: var(--text-secondary); line-height: 1.3; max-width: 220px; }
@media (max-width: 768px) {
  .video-slot-face { width: 56px; height: 56px; }
  .video-slot-swap, .video-slot-gap { height: 56px; }
  .video-slots-hint { font-size: 0.72rem; max-width: 160px; }
}

/* «Генерация видео»: the price inside the send button */
.send-btn.has-price {
  width: auto;
  padding: 0 12px 0 14px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Card generators: dark hint above the composer (decisions 2026-11-23), styled like the calories «+» hint. */
.chat-input-area { position: relative; }
.composer-hint { position: absolute; left: 50%; bottom: calc(100% - 10px); z-index: 30; display: flex; align-items: center; gap: 10px; width: max-content; max-width: min(460px, calc(100% - 32px)); padding: 10px 10px 10px 16px; border-radius: 18px; background: var(--text-primary); color: var(--bg-main); font-size: 14px; line-height: 1.35; box-shadow: 0 10px 28px #00000024; transform: translateX(-50%); animation: composer-hint-bob 2.4s ease-in-out infinite; }
.composer-hint::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 8px solid transparent; border-top-color: var(--text-primary); }
.composer-hint-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.composer-hint-text b { font-weight: 600; }
.composer-hint-text small { font-size: 12.5px; opacity: .78; }
.composer-hint-action { flex-shrink: 0; border: 0; border-radius: 12px; padding: 7px 11px; background: var(--bg-main); color: var(--text-primary); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
/* Close button: a round 30px target inside the bubble's padding (34px on phones). */
.composer-hint-close { flex-shrink: 0; align-self: flex-start; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--bg-main) 14%, transparent); color: inherit; font-size: 21px; line-height: 1; padding: 0; cursor: pointer; touch-action: manipulation; }
.composer-hint-close:hover, .composer-hint-close:focus-visible { background: color-mix(in srgb, var(--bg-main) 26%, transparent); }
@media (pointer: coarse), (max-width: 600px) { .composer-hint-close { width: 34px; height: 34px; font-size: 24px; } }
.composer-hint-on.chat-input-area .input-container { box-shadow: 0 0 0 2px var(--primary); }
.composer-hint-on.chat-input-area:has(.composer-hint-photo) .chat-options-row { border-radius: 12px; animation: composer-hint-pulse 1.8s ease-out 3; }
@keyframes composer-hint-bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -5px); } }
@keyframes composer-hint-pulse { 0% { box-shadow: 0 0 0 0 #0a7cff55; } 70% { box-shadow: 0 0 0 10px #0a7cff00; } 100% { box-shadow: 0 0 0 0 #0a7cff00; } }
@media (prefers-reduced-motion: reduce) { .composer-hint, .composer-hint-on .chat-options-row { animation: none !important; } }
@media (max-width: 600px) { .composer-hint { max-width: calc(100% - 24px); font-size: 13.5px; } }
.generation-feedback-fix { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 14px; }

/* AI Studio chat uses the same composer hint (2026-11-23). */
.composer-hint-host { position: relative; }
.composer-hint-actions { display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }
.studio-chat-composer.composer-hint-on { box-shadow: 0 0 0 2px var(--primary); }
.studio-chat-composer.composer-hint-on:has(.composer-hint-photo) .studio-chat-options { border-radius: 12px; animation: composer-hint-pulse 1.8s ease-out 3; }
.studio-chat-composer.composer-hint-on:has(.composer-hint-ask) [data-studio-setting="text"] { animation: composer-hint-pulse 1.8s ease-out 3; }
.composer-hint-ask { flex-wrap: wrap; width: min(440px, calc(100% - 32px)); }
.composer-hint-ask .composer-hint-text { flex: 1 1 0; }
.composer-hint-ask .composer-hint-close { order: 2; }
.composer-hint-ask .composer-hint-actions { order: 3; width: 100%; }
