/* ==================== ВИДЕОКОНТУР ENTERPRISE DESIGN SYSTEM FOR ATISCHAT ==================== */
:root,
html[data-theme="light"] {
  --font-inter: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Arial", sans-serif;

  /* Core Brand Palette (matching ВидеоКонтур site-theme.ts + globals.css) */
  --primary-50: #f0fdf4;
  --primary-100: #dcfce7;
  --primary-200: #bbf7d0;
  --primary-300: #86efac;
  --primary-400: #34d399;
  --primary-500: #10b981;
  --primary-600: #059669;
  --primary-700: #136844;
  --primary-800: #0f5a3b;
  --primary-900: #064e3b;
  --primary-950: #022c22;

  /* Neutral Slate Surfaces */
  --bg-main: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f8fafc;
  --bg-surface-hover: #f1f5f9;
  --bg-elevated: rgba(255, 255, 255, 0.88);
  --bg-modal: #ffffff;
  --bg-code: #0f172a;
  --bg-code-header: #1e293b;

  /* Typography */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-tertiary: #94a3b8;

  /* Borders & Focus */
  --border-subtle: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-green: #bbf7d0;
  --border-green-focus: #10b981;

  /* Accents */
  --accent-green: #136844;
  --accent-emerald: #059669;
  --accent-danger: #ef4444;
  --user-bubble: #f0fdf4;
  --user-bubble-border: #bbf7d0;

  /* Geometry & Shadows */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 240ms cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 24px -4px rgba(15, 23, 42, 0.09), 0 4px 8px -4px rgba(15, 23, 42, 0.05);
  --shadow-elevated: 0 22px 48px -10px rgba(15, 23, 42, 0.18), 0 8px 16px -6px rgba(15, 23, 42, 0.08);
  --shadow-input: 0 4px 16px rgba(15, 23, 42, 0.06);
}

html[data-theme="dark"] {
  --primary-50: rgba(16, 185, 129, 0.14);
  --primary-100: rgba(16, 185, 129, 0.2);
  --primary-200: rgba(16, 185, 129, 0.34);
  --primary-300: #6ee7b7;
  --primary-400: #34d399;
  --primary-500: #10b981;
  --primary-600: #059669;
  --primary-700: #10b981;
  --primary-800: #34d399;
  --primary-900: #064e3b;
  --primary-950: #022c22;

  --bg-main: #020617;
  --bg-sidebar: #0f172a;
  --bg-surface: #0f172a;
  --bg-surface-alt: #1e293b;
  --bg-surface-hover: #1e293b;
  --bg-elevated: rgba(15, 23, 42, 0.9);
  --bg-modal: #0f172a;
  --bg-code: #020617;
  --bg-code-header: #1e293b;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-tertiary: #64748b;

  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-hover: rgba(148, 163, 184, 0.28);
  --border-green: rgba(16, 185, 129, 0.32);
  --border-green-focus: #10b981;

  --accent-green: #136844;
  --accent-emerald: #10b981;
  --accent-danger: #f87171;
  --user-bubble: rgba(19, 104, 68, 0.26);
  --user-bubble-border: rgba(16, 185, 129, 0.38);

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 24px 56px rgba(0, 0, 0, 0.72);
  --shadow-input: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

::selection {
  background: rgba(19, 104, 68, 0.18);
  color: inherit;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-inter);
  font-size: 15px;
  background-color: var(--bg-main);
  background-image:
    radial-gradient(ellipse 80% 55% at 15% 0%, rgba(16, 185, 129, 0.06), transparent 65%),
    radial-gradient(ellipse 60% 45% at 88% 100%, rgba(59, 130, 246, 0.04), transparent 60%);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Slim Scrollbars (ВидеоКонтур .custom-slim-sidebar style) */
::-webkit-scrollbar,
.custom-slim-sidebar::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track,
.custom-slim-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb,
.custom-slim-sidebar::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover,
.custom-slim-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--primary-500);
}

/* ==================== ATISCHAT LOGO STYLING ==================== */
.atis-logo-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

html[data-theme="dark"] .atis-logo-img,
html[data-theme="dark"] .hero-logo-img,
html[data-theme="dark"] .portal-logo-img {
  filter: brightness(1.35);
}

/* ==================== FLOATING PORTAL HEADER (ВИДЕОКОНТУР STYLE) ==================== */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: calc(100% - 28px);
  margin: 10px auto 0;
  padding: 7px 16px;
  background: var(--bg-elevated);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
  z-index: 45;
  transition: box-shadow var(--transition-fast);
}

html[data-theme="dark"] .portal-header {
  box-shadow: var(--shadow-lg);
}

.portal-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.portal-logo-img {
  height: 30px;
  width: 30px;
  object-fit: contain;
  display: block;
}

.portal-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.portal-logo-text strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.portal-logo-text small {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.portal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

.portal-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.portal-nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.portal-nav-link.is-active {
  color: var(--primary-700);
  background: var(--primary-50);
  border-color: var(--border-green);
}

.portal-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Header Clock (PortalHeader exact component) */
.portal-header-clock {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 4px 10px 4px 8px;
  white-space: nowrap;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.portal-header-clock__icon {
  display: grid;
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  place-items: center;
  color: var(--primary-600);
}

.portal-header-clock__icon svg {
  width: 15px;
  height: 15px;
}

.portal-header-clock__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1;
  text-align: center;
}

.portal-header-clock__date {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.portal-header-clock__time {
  min-width: 60px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

/* Glowing Status Pill + Header Dual Quota Hover Card */
.header-quota-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.vc-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--primary-700);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.vc-status-pill:hover {
  filter: brightness(1.06);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.16);
}

.vc-status-pill.is-warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #b45309;
}

.vc-status-pill.is-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #dc2626;
}

.vc-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 6px #22c55e;
  flex-shrink: 0;
}

.portal-icon-button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.portal-icon-button:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

/* Header User Profile Chip (.portal-workspace exact clone) */
.portal-workspace {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 4px 6px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.portal-workspace:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-subtle);
}

.portal-workspace > span {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary-100), var(--primary-200));
  color: var(--primary-700);
  font-size: 12.5px;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.portal-workspace small {
  display: grid;
  text-align: left;
  gap: 1px;
  line-height: 1.15;
}

.portal-workspace small strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-workspace small em {
  font-size: 10.5px;
  font-style: normal;
  color: var(--text-muted);
}

/* ==================== SYSTEM NOTIFICATION TOAST ==================== */
#system-toast-container {
  position: fixed;
  top: 72px;
  right: 18px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.system-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 16px;
  background-color: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 18px 42px -12px rgba(15, 23, 42, 0.18), 0 6px 14px -4px rgba(15, 23, 42, 0.06);
  color: var(--text-primary);
  animation: fadeIn 0.2s ease;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.system-toast:hover {
  border-color: rgba(16, 185, 129, 0.34);
  transform: translateY(-1px);
}

html[data-theme="dark"] .system-toast {
  border-color: rgba(148, 163, 184, 0.20);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.65);
}

.system-toast-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background-color: rgba(16, 185, 129, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

html[data-theme="dark"] .system-toast-icon {
  background-color: rgba(16, 185, 129, 0.16);
}

.system-toast-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.system-toast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.system-toast-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.system-toast-meta {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--primary-700);
  background-color: rgba(16, 185, 129, 0.10);
  padding: 1px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}

html[data-theme="dark"] .system-toast-meta {
  color: var(--primary-300);
  background-color: rgba(16, 185, 129, 0.18);
}

.system-toast-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==================== 2-COLUMN WORKSPACE SHELL (ВИДЕОКОНТУР CARD GRID) ==================== */
.atis-workspace-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 14px;
  padding: 12px 14px 14px 14px;
  overflow: hidden;
  position: relative;
}

/* Left Card Sidebar (.system-sidebar exact clone) */
#chat-sidebar {
  width: 266px;
  min-width: 266px;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-smooth), min-width var(--transition-smooth), opacity var(--transition-fast), margin-right var(--transition-smooth);
  z-index: 40;
  user-select: none;
  overflow: hidden;
}

#chat-sidebar.collapsed {
  width: 0;
  min-width: 0;
  border: none;
  box-shadow: none;
  margin-right: -14px;
  opacity: 0;
  pointer-events: none;
}

.sidebar-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 10px;
  flex-shrink: 0;
}

.system-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.vc-collapse-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-alt);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.vc-collapse-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.vc-expand-btn {
  width: 34px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-hover);
  background: var(--bg-surface-alt);
  color: var(--primary-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.vc-expand-btn:hover {
  background: var(--primary-50);
  border-color: var(--primary-300);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
  padding: 0 12px;
}

/* Sidebar New Chat Button (Refined Enterprise Action Row) */
.sidebar-new-chat-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  margin: 2px 0 14px 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.sidebar-new-chat-btn:hover {
  background-color: var(--primary-50);
  border-color: rgba(16, 185, 129, 0.34);
  color: var(--primary-800);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.10);
}

.sidebar-new-chat-btn:active {
  transform: scale(0.99);
}

html[data-theme="dark"] .sidebar-new-chat-btn {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: none;
}

html[data-theme="dark"] .sidebar-new-chat-btn:hover {
  background-color: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.32);
  color: var(--primary-300);
  box-shadow: none;
}

.new-chat-icon-badge {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(135deg, #10b981, #136844);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(19, 104, 68, 0.24);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.sidebar-new-chat-btn:hover .new-chat-icon-badge {
  transform: scale(1.04);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.32);
}

.new-chat-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Primary Gradient Action Button (ВидеоКонтур .button-primary) */
.button-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.button-primary:hover {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.sidebar-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.sidebar-search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.sidebar-search-input {
  width: 100%;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 26px 6px 30px;
  font-size: 12.5px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.sidebar-search-input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.12);
}

.sidebar-search-clear {
  position: absolute;
  right: 6px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-search-clear.hidden {
  display: none;
}

.sidebar-search-clear:hover {
  color: var(--text-primary);
  background: var(--border-subtle);
}

#chat-sidebar-header {
  padding: 4px 6px 6px 6px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

#chat-list {
  list-style: none;
  overflow-y: auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 10px;
}

#chat-list li {
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  color: var(--text-primary);
  position: relative;
}

#chat-list li:hover {
  background-color: var(--bg-surface-alt);
  color: var(--primary-700);
}

#chat-list li.active {
  background-color: var(--primary-50);
  border-color: var(--border-green);
  color: var(--primary-800);
}

#chat-list li.active .chat-item-title {
  font-weight: 600;
  color: var(--primary-800);
}

.chat-item-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px 7px 10px;
  width: 100%;
  gap: 6px;
}

.chat-item-pin-badge {
  color: var(--primary-600);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.chat-item-title {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.chat-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.chat-item-action-btn,
.delete-chat-btn {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 3px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.chat-item-action-btn.is-pinned {
  opacity: 0.75;
  color: var(--primary-600);
}

#chat-list li:hover .chat-item-action-btn,
#chat-list li:hover .delete-chat-btn {
  opacity: 1;
}

.chat-item-action-btn:hover {
  color: var(--primary-700);
}

.delete-chat-btn:hover {
  color: var(--accent-danger);
}

/* Sidebar Footer Card */
.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-alt);
}

.user-card-minimal {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-card-minimal:hover {
  background-color: var(--bg-surface);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: #ffffff;
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex-grow: 1;
}

.user-display-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  width: fit-content;
  margin-top: 2px;
  background-color: var(--primary-50);
  border: 1px solid var(--border-green);
  color: var(--primary-700);
}

/* ==================== DUAL SVG QUOTA RINGS & CHATGPT-STYLE HOVER CARD ==================== */
.quota-ring-svg {
  transform: rotate(-90deg);
  display: block;
  flex-shrink: 0;
}

.ring-bg {
  stroke: rgba(148, 163, 184, 0.28);
}

.ring-progress {
  stroke: #10b981;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.35s ease, stroke 0.3s ease;
}

.ring-progress--weekly {
  stroke: #3b82f6;
}

.quota-ring-widget {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 29px;
  padding: 0 7px;
  border-radius: 999px;
  background-color: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: background-color var(--transition-fast);
}

.quota-ring-widget:hover {
  background-color: var(--bg-surface-hover);
}

.quota-cycle-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.quota-cycle-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.quota-cycle-sep {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1;
}

.quota-ring-pct {
  font-family: var(--font-inter);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.quota-ring-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 204px;
  padding: 9px 10px;
  border-radius: 12px;
  background-color: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 14px 32px -8px rgba(15, 23, 42, 0.18), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 95;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.97);
  transform-origin: bottom right;
  transition:
    opacity 0.18s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.18s;
}

html[data-theme="dark"] .quota-ring-tooltip {
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.65);
}

.header-quota-tooltip {
  bottom: auto;
  top: calc(100% + 8px);
  right: 0;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
}

.quota-ring-widget:hover .quota-ring-tooltip,
.header-quota-wrap:hover .header-quota-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.q-tt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 2px;
}

.q-tt-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.q-tt-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--primary-700);
  background: rgba(16, 185, 129, 0.12);
  padding: 1px 6px;
  border-radius: 999px;
}

html[data-theme="dark"] .q-tt-badge {
  color: var(--primary-300);
  background: rgba(16, 185, 129, 0.18);
}

.q-tt-cycle {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px 8px;
  border-radius: 8px;
  background-color: var(--bg-surface-alt);
}

.q-tt-cycle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.q-tt-cycle-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

.q-tt-cycle-pct {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #10b981;
}

.q-tt-bar {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background-color: var(--border-subtle);
  overflow: hidden;
}

.q-tt-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease, background-color 0.25s ease;
}

.q-tt-bar-fill--5h {
  background: linear-gradient(90deg, #10b981, #059669);
}

.q-tt-bar-fill--7d {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.q-tt-cycle-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 10px;
  line-height: 1.25;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.q-tt-foot {
  font-size: 9.5px;
  line-height: 1.2;
  color: var(--text-tertiary);
  text-align: center;
}

/* ==================== MAIN WORKSPACE CARD ==================== */
#main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.floating-sidebar-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 35;
  display: none;
}

#chat-sidebar.collapsed ~ #main-content .floating-sidebar-btn {
  display: inline-flex;
}

/* ==================== SYSTEM PROMPT & AGENT POPOVERS ==================== */
#system-prompt-container,
#agent-tools-popover,
#temp-mode-popover {
  position: absolute;
  bottom: 112px;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, calc(100% - 36px));
  background-color: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 20px 46px -12px rgba(15, 23, 42, 0.16), 0 6px 14px -4px rgba(15, 23, 42, 0.06);
  z-index: 50;
  display: none;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.16s ease;
}

#agent-tools-popover,
#temp-mode-popover {
  left: max(18px, calc(50% - 28rem + 18px));
  transform: none;
  width: min(375px, calc(100% - 36px));
}

#system-prompt-container {
  left: max(18px, calc(50% - 28rem + 18px));
  transform: none;
  width: min(490px, calc(100% - 36px));
}

html[data-theme="dark"] #system-prompt-container,
html[data-theme="dark"] #agent-tools-popover,
html[data-theme="dark"] #temp-mode-popover {
  border-color: rgba(148, 163, 184, 0.20);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.68);
}

#system-prompt-container.open,
#agent-tools-popover.open,
#temp-mode-popover.open {
  display: flex;
}

.agent-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-popover-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.agent-popover-icon-tile {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--primary-700);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

html[data-theme="dark"] .agent-popover-icon-tile {
  background: rgba(16, 185, 129, 0.18);
  color: var(--primary-300);
}

.agent-popover-titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.agent-popover-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.agent-popover-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.3;
}

.popover-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

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

.agent-master-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 12px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.agent-master-switch-row:hover {
  border-color: rgba(16, 185, 129, 0.30);
}

.agent-master-switch-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.agent-master-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.agent-master-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Sleek Enterprise Pill Toggle Switch */
.vc-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.vc-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.vc-switch-track {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background-color: var(--border-hover);
  position: relative;
  transition: background-color 0.2s ease;
}

.vc-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.24);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.vc-switch input:checked + .vc-switch-track {
  background: linear-gradient(135deg, #10b981, #136844);
}

.vc-switch input:checked + .vc-switch-track::after {
  transform: translateX(16px);
}

.agent-tools-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 0 2px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.agent-tools-count-pill {
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--primary-700);
  background: rgba(16, 185, 129, 0.10);
  padding: 2px 8px;
  border-radius: 999px;
}

html[data-theme="dark"] .agent-tools-count-pill {
  color: var(--primary-300);
  background: rgba(16, 185, 129, 0.16);
}

.agent-tools-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-right: 2px;
  transition: opacity var(--transition-fast);
}

.agent-tools-list.is-paused {
  opacity: 0.56;
}

.agent-tool-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}

.agent-tool-item:hover {
  background-color: var(--bg-surface);
  border-color: var(--border-hover);
}

.agent-tool-item.is-selected {
  background-color: var(--bg-surface);
  border-color: rgba(16, 185, 129, 0.30);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

html[data-theme="dark"] .agent-tool-item.is-selected {
  background-color: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.28);
  box-shadow: none;
}

.agent-tool-cb {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.agent-tool-check {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--border-hover);
  background-color: var(--bg-surface);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.agent-tool-check svg {
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.agent-tool-cb:checked + .agent-tool-check {
  background: linear-gradient(135deg, #10b981, #136844);
  border-color: transparent;
  box-shadow: 0 1px 4px rgba(19, 104, 68, 0.28);
}

.agent-tool-cb:checked + .agent-tool-check svg {
  opacity: 1;
  transform: scale(1);
}

.agent-tool-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.agent-tool-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.agent-tool-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.agent-tool-slug {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-muted);
  background-color: var(--bg-surface-hover);
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.4;
}

.agent-tool-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.agent-step-card {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 0.79rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 6px;
}

.agent-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

.agent-step-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.73rem;
  color: var(--text-secondary);
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  padding: 6px 8px;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 150px;
  overflow-y: auto;
}

.system-prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

#system-prompt-textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px 12px;
  background-color: var(--bg-surface-alt);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.84rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}

#system-prompt-textarea:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.system-prompt-controls {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.system-prompt-button {
  padding: 7px 14px;
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
}

#save-prompt {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: #ffffff;
  border: none;
}

/* ==================== CHAT SECTION & ВИДЕОКОНТУР HERO ==================== */
#chat-section {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

#chat-container {
  flex-grow: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px 18px 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
  user-select: text;
}

#empty-state {
  margin: auto;
  max-width: 700px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
  gap: 18px;
}

#empty-state.hidden {
  display: none;
}

.vc-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-logo-box {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background-color: var(--primary-50);
  border: 1px solid var(--border-green);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.hero-logo-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.hero-product-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

.hero-product-title span {
  color: var(--primary-600);
}

.hero-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

/* Overview Action Grid Cards (ВидеоКонтур .overview-action-card exact clone) */
.starter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 660px;
  margin-top: 4px;
}

.starter-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.starter-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.oac-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.oac-body {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.oac-body strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}

.oac-body span {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  line-height: 1.35;
}

.oac-arrow {
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.starter-card:hover .oac-arrow {
  transform: translateX(3px);
  color: var(--text-secondary);
}

.overview-action-card--green .oac-icon { background: #ecfdf5; color: #059669; }
.overview-action-card--green:hover { background: #f0fdf4; border-color: #bbf7d0; }

.overview-action-card--blue .oac-icon { background: #eff6ff; color: #2563eb; }
.overview-action-card--blue:hover { background: #f0f9ff; border-color: #bfdbfe; }

.overview-action-card--amber .oac-icon { background: #fef3c7; color: #d97706; }
.overview-action-card--amber:hover { background: #fffbeb; border-color: #fde68a; }

.overview-action-card--violet .oac-icon { background: #ede9fe; color: #7c3aed; }
.overview-action-card--violet:hover { background: #f5f3ff; border-color: #ddd6fe; }

html[data-theme="dark"] .overview-action-card--green .oac-icon { background: rgba(16, 185, 129, 0.16); color: #34d399; }
html[data-theme="dark"] .overview-action-card--green:hover { background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.4); }

html[data-theme="dark"] .overview-action-card--blue .oac-icon { background: rgba(59, 130, 246, 0.16); color: #60a5fa; }
html[data-theme="dark"] .overview-action-card--blue:hover { background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.4); }

html[data-theme="dark"] .overview-action-card--amber .oac-icon { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
html[data-theme="dark"] .overview-action-card--amber:hover { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.4); }

html[data-theme="dark"] .overview-action-card--violet .oac-icon { background: rgba(139, 92, 246, 0.16); color: #a78bfa; }
html[data-theme="dark"] .overview-action-card--violet:hover { background: rgba(139, 92, 246, 0.08); border-color: rgba(139, 92, 246, 0.4); }

/* ==================== MESSAGES & SERVICE BUBBLES ==================== */
.message {
  width: 100%;
  min-width: 0;
  max-width: 50rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  font-size: 0.94rem;
  line-height: 1.65;
  animation: fadeIn 0.2s ease;
  position: relative;
  user-select: text;
}

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

.user-bubble-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 78%;
  min-width: 0;
  justify-content: flex-end;
}

.edit-msg-btn {
  opacity: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background-color: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}

.user-message:hover .edit-msg-btn {
  opacity: 1;
}

.edit-msg-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

.user-message .message-content {
  background-color: var(--user-bubble);
  border: 1px solid var(--user-bubble-border);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: 16px 16px 4px 16px;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
}

.user-message .message-content > div,
.user-message .message-content p {
  margin: 0;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inline-edit-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-green-focus);
  border-radius: var(--radius-md);
  padding: 12px;
  width: min(540px, 80vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-md);
}

.inline-edit-textarea {
  width: 100%;
  min-height: 68px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.94rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}

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

/* Assistant Message (ВидеоКонтур Clean Panel Aesthetic) */
.assistant-message {
  align-items: flex-start;
  padding-left: 44px;
  position: relative;
}

.assistant-avatar-svg {
  position: absolute;
  left: 0;
  top: 2px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border-green);
  background-color: var(--primary-50);
  display: flex;
  align-items: center;
  justify-content: center;
}

.message-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.message-model {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: 6px;
}

.message-content {
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: flex;
  flex-direction: column;
  gap: 10px;
  user-select: text;
}

/* System Service Limit Bubble (5-Hour Quota Reached) */
.service-limit-bubble {
  width: 100%;
  max-width: 46rem;
  margin: 4px auto;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  animation: fadeIn 0.25s ease;
}

html[data-theme="dark"] .service-limit-bubble {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
}

.service-limit-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background-color: rgba(245, 158, 11, 0.16);
  color: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.service-limit-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
}

.service-limit-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.service-limit-desc {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.service-limit-timer {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  font-weight: 600;
  color: #b45309;
  background-color: rgba(245, 158, 11, 0.15);
  padding: 4px 10px;
  border-radius: 999px;
  width: fit-content;
}

html[data-theme="dark"] .service-limit-timer {
  color: #fbbf24;
}

/* Collapsible Thinking Process & MCP Agent Spoilers */
.thinking-details {
  width: 100%;
  margin-bottom: 4px;
  border-radius: 10px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.thinking-details.hidden {
  display: none;
}

.thinking-summary {
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

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

.thinking-summary:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

.thinking-summary .chevron {
  transition: transform 0.2s ease;
  margin-left: auto;
}

.thinking-details[open] .thinking-summary .chevron {
  transform: rotate(180deg);
}

.thinking-body {
  padding: 10px 14px 12px 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
  user-select: text;
}

.answer-section {
  width: 100%;
  user-select: text;
}

/* Assistant Message Footer Bar */
.message-footer-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-top: 8px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.msg-action-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 8px;
  transition: all var(--transition-fast);
}

.msg-action-btn:hover {
  background-color: var(--bg-surface-alt);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.msg-export-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

.msg-export-btn.is-pdf:hover {
  background-color: rgba(220, 38, 38, 0.09);
  border-color: rgba(220, 38, 38, 0.35);
  color: #dc2626;
}

.msg-export-btn.is-word:hover {
  background-color: rgba(37, 99, 235, 0.09);
  border-color: rgba(37, 99, 235, 0.35);
  color: #2563eb;
}

.msg-export-btn.is-excel:hover {
  background-color: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.38);
  color: #15803d;
}

html[data-theme="dark"] .msg-export-btn.is-pdf:hover {
  color: #f87171;
}

html[data-theme="dark"] .msg-export-btn.is-word:hover {
  color: #60a5fa;
}

html[data-theme="dark"] .msg-export-btn.is-excel:hover {
  color: #4ade80;
}

.msg-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.71rem;
}

/* Markdown Typography */
.message-content h1, .message-content h2, .message-content h3, .message-content h4,
.answer-section h1, .answer-section h2, .answer-section h3, .answer-section h4 {
  margin: 14px 0 8px 0;
  font-weight: 700;
  color: var(--text-primary);
}

.message-content p, .answer-section p {
  margin: 0 0 10px 0;
}

.message-content p:last-child, .answer-section p:last-child {
  margin-bottom: 0;
}

.message-content ul, .message-content ol,
.answer-section ul, .answer-section ol {
  margin: 0 0 12px 22px;
}

.message-content code, .answer-section code, .thinking-body code {
  background-color: var(--bg-surface-hover);
  color: var(--primary-700);
  padding: 0.15em 0.42em;
  border-radius: 5px;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.85em;
}

.message-content pre, .answer-section pre, .thinking-body pre {
  background-color: var(--bg-code);
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  padding: 38px 16px 14px 16px;
  max-width: 100%;
  overflow-x: auto;
  overflow-wrap: normal;
  word-break: normal;
  margin: 12px 0;
  position: relative;
  user-select: text;
}

.message-content pre::before, .answer-section pre::before, .thinking-body pre::before {
  content: "A-GPT Code";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 30px;
  background-color: var(--bg-code-header);
  border-bottom: 1px solid #334155;
  padding: 0 14px;
  display: flex;
  align-items: center;
  font-family: var(--font-inter);
  font-size: 0.72rem;
  font-weight: 600;
  color: #cbd5e1;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

.message-content pre code, .answer-section pre code, .thinking-body pre code {
  background: transparent;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: #f1f5f9;
  user-select: text;
}

.code-pre-actions {
  position: absolute;
  top: 3px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.copy-btn {
  position: static;
  background: transparent;
  color: #cbd5e1;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-inter);
  font-size: 0.72rem;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.copy-btn:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.12);
}

.preview-code-btn {
  position: static;
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-inter);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color var(--transition-fast);
}

.preview-code-btn:hover {
  background: rgba(16, 185, 129, 0.32);
  color: #ffffff;
}

.mermaid-diagram-card {
  margin: 10px 0;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-surface);
  overflow: hidden;
}

.mermaid-diagram-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.mermaid-diagram-svg {
  padding: 14px;
  overflow-x: auto;
  display: flex;
  justify-content: center;
}

.mermaid-diagram-svg svg {
  max-width: 100%;
  height: auto;
}

.adm-custom-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-surface-alt);
}

@media (max-width: 780px) {
  .adm-custom-row {
    grid-template-columns: 1fr;
  }
}

/* ==================== COMPOSER CARD (COMPACT SINGLE-ROW ENTERPRISE DESIGN) ==================== */
.composer-wrapper {
  width: 100%;
  max-width: 58rem;
  margin: 0 auto;
  padding: 4px 18px 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 20;
}

#stop-button {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--bg-modal);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

#stop-button:hover {
  border-color: var(--accent-danger);
  color: var(--accent-danger);
  transform: translateX(-50%) translateY(-1px);
}

.composer-card {
  width: 100%;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 11px 12px 9px 15px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: 0 8px 28px -6px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

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

.composer-card:focus-within {
  border-color: rgba(16, 185, 129, 0.52);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.10), 0 12px 32px -6px rgba(15, 23, 42, 0.12);
}

html[data-theme="dark"] .composer-card {
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.48);
}

html[data-theme="dark"] .composer-card:hover {
  border-color: rgba(148, 163, 184, 0.30);
}

html[data-theme="dark"] .composer-card:focus-within {
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14), 0 16px 36px rgba(0, 0, 0, 0.56);
}

.composer-card.drag-over {
  border-color: var(--primary-500);
  background-color: var(--primary-50);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

#attachments-preview.attachments-preview-strip {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
}

.attachment-chip-img {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--primary-500);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.attachment-chip-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-chip-doc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  padding: 5px 8px 5px 10px;
  border-radius: 10px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  font-size: 0.77rem;
  color: var(--text-primary);
}

.attachment-chip-doc-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-chip-doc-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.attachment-chip-remove {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.55);
  color: #ffffff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.attachment-chip-img .attachment-chip-remove {
  position: absolute;
  top: 3px;
  right: 3px;
}

.attachment-chip-doc .attachment-chip-remove {
  background: transparent;
  color: var(--text-muted);
}

.attachment-chip-doc .attachment-chip-remove:hover {
  color: var(--accent-danger);
  background: rgba(239, 68, 68, 0.1);
}

.msg-attachments-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.msg-doc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border-subtle);
  font-size: 0.76rem;
  color: var(--text-primary);
}

html[data-theme="dark"] .msg-doc-badge {
  background: rgba(15, 23, 42, 0.45);
}

.msg-doc-badge-ext {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--primary-50);
  color: var(--primary-700);
}

#user-input {
  width: 100%;
  max-height: 180px;
  min-height: 24px;
  padding: 1px 2px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.93rem;
  line-height: 1.48;
  resize: none;
  outline: none;
  overflow-y: auto;
}

#user-input::placeholder {
  color: var(--text-tertiary);
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.composer-tools-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
  flex: 1 1 auto;
}

.composer-tools-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.composer-tool-btn {
  height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  background-color: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.composer-tool-btn--icon {
  width: 28px;
  padding: 0;
  border-radius: 50%;
}

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

.composer-tool-btn.active {
  background-color: rgba(16, 185, 129, 0.10);
  color: var(--primary-700);
  border-color: rgba(16, 185, 129, 0.22);
  font-weight: 600;
}

.composer-tool-btn.active:hover {
  background-color: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.30);
}

html[data-theme="dark"] .composer-tool-btn.active {
  background-color: rgba(16, 185, 129, 0.16);
  color: var(--primary-300);
  border-color: rgba(16, 185, 129, 0.28);
}

html[data-theme="dark"] .composer-tool-btn.active:hover {
  background-color: rgba(16, 185, 129, 0.22);
}

.composer-search-btn.active {
  background-color: rgba(37, 99, 235, 0.10);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.25);
  font-weight: 600;
}

.composer-search-btn.active:hover {
  background-color: rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.34);
}

html[data-theme="dark"] .composer-search-btn.active {
  background-color: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.32);
}

html[data-theme="dark"] .composer-search-btn.active:hover {
  background-color: rgba(59, 130, 246, 0.24);
}

/* DeepSeek-style Web Search Sources Strip inside Assistant Messages */
.web-sources-details .thinking-summary {
  color: #2563eb;
}

html[data-theme="dark"] .web-sources-details .thinking-summary {
  color: #93c5fd;
}

.web-sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 8px;
}

.web-source-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 11px;
  border-radius: 10px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
}

.web-source-card:hover {
  border-color: rgba(37, 99, 235, 0.42);
  background-color: var(--bg-surface-hover);
  transform: translateY(-1px);
}

.web-source-domain {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-theme="dark"] .web-source-domain {
  color: #93c5fd;
}

.web-source-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.web-source-snippet {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.composer-model-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

#model-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.custom-model-btn {
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 230px;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.custom-model-btn:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.10);
}

.custom-model-btn.open {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.custom-model-btn:disabled,
.custom-model-btn.is-empty {
  opacity: 0.72;
  cursor: default;
}

.custom-model-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
  flex-shrink: 0;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.custom-model-btn.is-empty .custom-model-dot {
  background: #94a3b8;
  box-shadow: none;
}

.custom-model-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-model-vision {
  display: inline-flex;
  align-items: center;
  color: #16a34a;
  flex-shrink: 0;
  opacity: 0.85;
}

.custom-model-vision.hidden {
  display: none;
}

html[data-theme="dark"] .custom-model-vision {
  color: #34d399;
}

.custom-model-brain {
  display: inline-flex;
  align-items: center;
  color: #7c3aed;
  flex-shrink: 0;
  opacity: 0.86;
}

.custom-model-brain.hidden {
  display: none;
}

html[data-theme="dark"] .custom-model-brain {
  color: #c4b5fd;
}

.custom-model-cap-icon {
  display: inline-flex;
  align-items: center;
  color: #16a34a;
  opacity: 0.82;
  flex-shrink: 0;
}

.custom-model-cap-icon.is-brain {
  color: #7c3aed;
  opacity: 0.86;
}

html[data-theme="dark"] .custom-model-cap-icon {
  color: #34d399;
}

html[data-theme="dark"] .custom-model-cap-icon.is-brain {
  color: #c4b5fd;
}

.custom-model-row-icons {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-left: 2px;
}

.custom-model-effort {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

.custom-model-effort.is-extra {
  color: #7c3aed;
}

html[data-theme="dark"] .custom-model-effort.is-extra {
  color: #c4b5fd;
}

.custom-model-btn.is-empty .custom-model-effort,
.custom-model-effort:empty {
  display: none;
}

.select-chevron-svg {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
}

.custom-model-btn.open .select-chevron-svg {
  transform: rotate(180deg);
  color: #136844;
}

html[data-theme="dark"] .custom-model-btn.open .select-chevron-svg {
  color: #34d399;
}

/* Smooth Upward Glassmorphic Model Picker Menu + Reasoning Flyout */
.custom-model-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: min(262px, calc(100vw - 24px));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  padding: 5px;
  box-shadow: 0 18px 40px -10px rgba(15, 23, 42, 0.20), 0 6px 14px -4px rgba(15, 23, 42, 0.08);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 3px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom right;
  transition:
    opacity 0.20s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.20s;
}

html[data-theme="dark"] .custom-model-menu {
  background: rgba(24, 31, 44, 0.96);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.65);
}

.custom-model-menu.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.custom-model-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px 1px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.custom-model-search-wrap {
  padding: 1px 2px 2px 2px;
}

.custom-model-search-wrap.hidden {
  display: none;
}

.custom-model-search {
  width: 100%;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11.5px;
  outline: none;
  transition: border-color 0.18s ease;
}

.custom-model-search:focus {
  border-color: rgba(16, 185, 129, 0.55);
}

.custom-model-list {
  max-height: 236px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-right: 1px;
}

.custom-model-group-label {
  padding: 4px 6px 1px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.custom-model-group-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.custom-model-option {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  padding: 5px 7px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-family: inherit;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.custom-model-option:hover,
.custom-model-option:focus-visible,
.custom-model-option.is-flyout-target {
  background: var(--bg-surface-hover);
  outline: none;
}

.custom-model-option.is-selected {
  background: rgba(16, 185, 129, 0.11);
  border-color: rgba(16, 185, 129, 0.28);
}

html[data-theme="dark"] .custom-model-option.is-selected {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.36);
}

.custom-model-option-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.custom-model-active-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #16a34a;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.custom-model-option.is-selected .custom-model-active-dot {
  opacity: 1;
  transform: scale(1);
}

.custom-model-option-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-model-option-right {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.custom-model-row-effort {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 1px 5px;
  border-radius: 5px;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.custom-model-row-effort.is-extra {
  color: #7c3aed;
}

html[data-theme="dark"] .custom-model-row-effort.is-extra {
  color: #c4b5fd;
}

.custom-model-row-chevron {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  opacity: 0.68;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.custom-model-option:hover .custom-model-row-chevron,
.custom-model-option.is-flyout-target .custom-model-row-chevron {
  opacity: 1;
  transform: translateX(1px);
}

/* Cascading Reasoning Complexity Submenu Flyout */
.custom-effort-flyout {
  position: absolute;
  top: 0;
  left: calc(100% + 6px);
  width: 162px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 5px;
  box-shadow: 0 18px 40px -10px rgba(15, 23, 42, 0.22), 0 6px 14px -4px rgba(15, 23, 42, 0.08);
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-6px) scale(0.96);
  transform-origin: top left;
  transition:
    opacity 0.16s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.20s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.16s;
}

.custom-effort-flyout.flip-left {
  left: auto;
  right: calc(100% + 6px);
  transform: translateX(6px) scale(0.96);
  transform-origin: top right;
}

html[data-theme="dark"] .custom-effort-flyout {
  background: rgba(24, 31, 44, 0.97);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.70);
}

.custom-effort-flyout.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

.custom-effort-flyout-head {
  padding: 2px 7px 3px 7px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-effort-options {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.custom-effort-option {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  padding: 5px 7px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  transition: background-color 0.13s ease, border-color 0.13s ease;
}

.custom-effort-option:hover,
.custom-effort-option:focus-visible {
  background: var(--bg-surface-hover);
  outline: none;
}

.custom-effort-option.is-active {
  background: rgba(16, 185, 129, 0.11);
  border-color: rgba(16, 185, 129, 0.26);
  font-weight: 600;
}

html[data-theme="dark"] .custom-effort-option.is-active {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.34);
}

.custom-effort-opt-main {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}

.custom-effort-opt-hint {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.78;
}

.custom-effort-opt-check {
  color: #16a34a;
  display: inline-flex;
  align-items: center;
  opacity: 0;
  flex-shrink: 0;
}

.custom-effort-opt-check svg {
  width: 13px;
  height: 13px;
}

.custom-effort-option.is-active .custom-effort-opt-check {
  opacity: 1;
}

#send-button {
  background: linear-gradient(135deg, #10b981, #136844);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 31px;
  height: 31px;
  margin-left: 2px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(19, 104, 68, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

#send-button.is-empty:not(:disabled) {
  background: var(--bg-surface-hover);
  color: var(--text-tertiary);
  box-shadow: none;
}

#send-button.is-empty:not(:disabled):hover {
  background: var(--border-subtle);
  color: var(--text-secondary);
  transform: none;
  box-shadow: none;
}

#send-button:not(.is-empty):hover:not(:disabled) {
  background: linear-gradient(135deg, #34d399, #059669);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.36);
  transform: translateY(-1px);
}

#send-button:disabled {
  background: var(--bg-surface-hover);
  color: var(--text-tertiary);
  box-shadow: none;
  cursor: not-allowed;
}

/* ==================== MODALS & ВИДЕОКОНТУР SPLIT LOGIN CARD ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background-color: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  box-shadow: var(--shadow-elevated);
  width: 100%;
  max-width: 460px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadeIn 0.22s ease;
}

.modal-card.medium {
  max-width: 660px;
  max-height: 90vh;
  overflow-y: auto;
}

/* Split Login Card matching ВидеоКонтур .login-card + .register-brand */
.modal-card.login-card-split {
  max-width: 820px;
  padding: 0;
  display: grid;
  grid-template-columns: 300px 1fr;
  overflow: hidden;
  border-radius: 24px;
  gap: 0;
}

.atis-login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 32px 26px;
  background: linear-gradient(160deg, #022c22 0%, #064e3b 45%, #065f46 100%);
  color: #ffffff;
  overflow: hidden;
}

.atis-login-brand::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -40%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.24), transparent 60%);
  pointer-events: none;
}

.atis-login-logo-box {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  margin-bottom: 16px;
}

.atis-login-logo-box img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.atis-login-brand strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #ffffff;
  margin-bottom: 6px;
}

.atis-login-brand span {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.5;
}

.atis-login-features {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.atis-login-feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.atis-login-form-side {
  padding: 34px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  background-color: var(--bg-modal);
}

.register-title h1 {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.register-title p {
  font-size: 13.5px;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  background-color: var(--bg-surface-alt);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
}

.auth-tab.active {
  background-color: var(--bg-surface);
  color: var(--primary-700);
  border-color: var(--border-green);
  box-shadow: var(--shadow-sm);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input, .form-select {
  width: 100%;
  padding: 9px 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hover);
  border-radius: 9px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.btn-primary {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: #ffffff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
  transform: translateY(-1px);
}

.btn-green {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: #ffffff;
}

.btn-secondary {
  padding: 7px 14px;
  border-radius: 9px;
  border: 1px solid var(--border-hover);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-alt);
  box-shadow: var(--shadow-sm);
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-danger);
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.14);
}

.auth-error {
  font-size: 0.8rem;
  color: #b91c1c;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  display: none;
}

.auth-email-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.auth-send-code-btn {
  flex-shrink: 0;
  white-space: nowrap;
  border-radius: 10px;
  font-size: 12.5px;
  padding: 0 13px;
}

.auth-email-status {
  display: none;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--primary-700);
  margin-top: 3px;
}

html[data-theme="dark"] .auth-email-status {
  color: var(--primary-300);
}

.auth-code-input {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.25em;
  font-weight: 700;
  text-align: center;
  font-size: 1rem;
}

/* ==================== ADMIN FULL PAGE (ВИДЕОКОНТУР 2-COLUMN SHELL) ==================== */
.admin-fullpage {
  position: fixed;
  inset: 0;
  background-color: var(--bg-main);
  background-image:
    radial-gradient(ellipse 80% 55% at 15% 0%, rgba(16, 185, 129, 0.06), transparent 65%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.admin-fullpage-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.admin-workspace-shell {
  display: grid;
  grid-template-columns: 245px 1fr;
  gap: 16px;
  padding: 14px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  align-items: start;
}

.admin-nav.system-sidebar {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  max-height: 100%;
  overflow-y: auto;
}

.admin-nav-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
  padding: 8px 8px 3px 8px;
}

.admin-nav-group-title:first-child {
  padding-top: 2px;
}

.admin-tab-btn.system-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
}

.admin-tab-btn.system-sidebar-item:hover {
  background: var(--bg-surface-alt);
  color: var(--primary-700);
}

.admin-tab-btn.system-sidebar-item.active {
  background: var(--primary-50);
  border-color: var(--border-green);
  color: var(--primary-700);
  font-weight: 700;
}

.admin-tab-btn.system-sidebar-item.active svg {
  color: var(--primary-600);
}

.admin-body.system-content {
  height: 100%;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-pane {
  display: none;
  flex-direction: column;
  gap: 18px;
}

.admin-pane.active {
  display: flex;
}

/* Metric Cards (ВидеоКонтур OverviewDashboard top-3px accent style) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-card--green { border-top: 3px solid #10b981; }
.metric-card--blue { border-top: 3px solid #3b82f6; }
.metric-card--amber { border-top: 3px solid #f59e0b; }
.metric-card--violet { border-top: 3px solid #8b5cf6; }

.metric-card--green .stat-card-value { color: #059669; }
.metric-card--blue .stat-card-value { color: #2563eb; }
.metric-card--amber .stat-card-value { color: #d97706; }
.metric-card--violet .stat-card-value { color: #7c3aed; }

html[data-theme="dark"] .metric-card--green .stat-card-value { color: #34d399; }
html[data-theme="dark"] .metric-card--blue .stat-card-value { color: #60a5fa; }
html[data-theme="dark"] .metric-card--amber .stat-card-value { color: #fbbf24; }
html[data-theme="dark"] .metric-card--violet .stat-card-value { color: #a78bfa; }

.stat-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat-card-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}

.table-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 10px;
}

.table-scroll {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}

.admin-table th {
  padding: 11px 16px;
  background-color: var(--bg-surface-alt);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background-color: var(--bg-surface-alt);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.status-pill.active {
  background-color: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--border-green);
}

.status-pill.blocked {
  background-color: rgba(239, 68, 68, 0.12);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.model-chip {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ==================== USER PROFILE MODAL (COMPACT BENTO) ==================== */
.profile-modal-card {
  max-width: 630px;
  padding: 18px 20px;
  border-radius: 18px;
  gap: 11px;
}

.profile-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-identity-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.profile-avatar-lg {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #10b981, #136844);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(19, 104, 68, 0.22);
}

.profile-identity-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.profile-identity-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.profile-hero-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.profile-role-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.12);
  color: var(--primary-700);
  border: 1px solid rgba(16, 185, 129, 0.24);
}

html[data-theme="dark"] .profile-role-pill {
  background: rgba(16, 185, 129, 0.18);
  color: var(--primary-300);
  border-color: rgba(16, 185, 129, 0.30);
}

.profile-hero-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.profile-dot-sep {
  opacity: 0.5;
}

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

.profile-logout-sm-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.06);
  color: var(--accent-danger);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.profile-logout-sm-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.36);
}

/* Slim 2-column Quota Strip */
.profile-quota-strip {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 13px;
  border-radius: 12px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
}

.profile-quota-divider {
  width: 1px;
  height: 36px;
  background-color: var(--border-subtle);
}

.profile-quota-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.profile-quota-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.profile-quota-row-title {
  font-weight: 600;
  color: var(--text-primary);
}

.profile-quota-row-pct {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #10b981;
}

.profile-quota-bar {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background-color: var(--border-subtle);
  overflow: hidden;
}

.profile-quota-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.3s ease;
}

.profile-quota-fill--7d {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.profile-quota-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Panels Grid: Models & Usage */
.profile-panels-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 10px;
}

.profile-info-panel {
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.profile-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.profile-panel-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.profile-count-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 999px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.profile-chips-compact {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 5px;
  max-height: 104px;
  overflow-y: auto;
}

.profile-chips-compact .model-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 7px;
  gap: 5px;
}

.profile-model-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
}

.profile-model-q {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.profile-usage-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 104px;
  overflow-y: auto;
}

.profile-usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 11.5px;
  transition: background-color 0.14s ease;
}

.profile-usage-row:hover {
  background-color: var(--bg-surface);
}

.profile-usage-name {
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.profile-usage-stats {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.profile-empty-state {
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 2px 0;
}

/* One-line Compact Profile Settings Form */
.profile-settings-form {
  padding-top: 2px;
}

.profile-form-inline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}

.profile-compact-field {
  margin-bottom: 0;
  gap: 3px;
}

.profile-compact-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.profile-compact-field .form-input {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 8px;
}

.profile-save-btn {
  border-radius: 8px;
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
  white-space: nowrap;
}

/* Compact IDE API Keys Section */
.profile-apikeys-panel {
  gap: 7px;
}

.profile-api-url-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.profile-api-url-chip:hover {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.06);
}

.profile-api-url-chip code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
}

.profile-apikey-create-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.profile-apikey-create-row .form-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 8px;
}

.profile-apikey-add-btn {
  height: 30px;
  padding: 0 11px;
  font-size: 11.5px;
  border-radius: 8px;
  white-space: nowrap;
}

.profile-apikey-banner {
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.10);
  border: 1px solid rgba(16, 185, 129, 0.30);
  font-size: 11px;
}

.profile-apikey-banner-note {
  font-weight: 600;
  color: #047857;
  margin-bottom: 3px;
}

html[data-theme="dark"] .profile-apikey-banner-note {
  color: #34d399;
}

.profile-apikey-banner-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-apikey-banner-row code {
  font-size: 11px;
  word-break: break-all;
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
}

.profile-apikey-copy-btn {
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 6px;
  flex-shrink: 0;
}

.profile-api-keys-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 92px;
  overflow-y: auto;
}

@media (max-width: 640px) {
  .profile-quota-strip {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .profile-quota-divider {
    width: 100%;
    height: 1px;
  }
  .profile-panels-grid,
  .profile-form-inline-grid {
    grid-template-columns: 1fr;
  }
}

.role-checks {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.role-check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  color: var(--text-primary);
}

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

.preset-chip {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.preset-chip:hover {
  background-color: var(--primary-50);
  color: var(--primary-700);
  border-color: var(--border-green);
}

.roles-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

#context-menu {
  position: absolute;
  display: none;
  flex-direction: column;
  min-width: 170px;
  background-color: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px;
  z-index: 1000;
  box-shadow: var(--shadow-elevated);
}

.context-menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.context-menu-item:hover {
  background-color: var(--bg-surface-alt);
}

.context-menu-item.danger {
  color: var(--accent-danger);
}

.context-menu-item.danger:hover {
  background-color: rgba(239, 68, 68, 0.08);
}

.context-usage-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  flex-shrink: 0;
}

.context-usage-pill.is-warn {
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.08);
}

.context-usage-pill.is-high {
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
}

.auth-forgot-link {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--primary-600);
  cursor: pointer;
}

.auth-forgot-link:hover {
  text-decoration: underline;
}

.prof-apikey-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 11.5px;
}

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

/* ==================== SHARE, CREATIVITY, ANALYTICS & DLP UI ==================== */
.floating-share-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--font-inter);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition: all var(--transition-fast);
}

.floating-share-btn:hover {
  color: #136844;
  border-color: rgba(22, 163, 74, 0.45);
  background: rgba(16, 185, 129, 0.08);
}

.floating-share-btn.hidden {
  display: none !important;
}

.temp-mode-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.temp-preset-card {
  text-align: left;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all var(--transition-fast);
}

.temp-preset-card strong {
  font-size: 0.84rem;
}

.temp-preset-card span {
  font-size: 0.73rem;
  color: var(--text-secondary);
}

.temp-preset-card:hover {
  border-color: rgba(22, 163, 74, 0.45);
}

.temp-preset-card.active {
  border-color: #16a34a;
  background: rgba(16, 185, 129, 0.12);
}

.temp-slider-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
}

.temp-slider-row input[type="range"] {
  width: 100%;
  accent-color: #16a34a;
}

.reasoning-effort-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.reasoning-pill {
  padding: 5px 6px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-alt);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.reasoning-pill.active {
  background: #136844;
  color: #ffffff;
  border-color: #136844;
}

.analytics-period-pills {
  display: inline-flex;
  gap: 4px;
}

.adm-period-btn.active {
  background: #136844;
  color: #ffffff;
  border-color: #136844;
}

.analytics-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px;
}

.analytics-chart-box {
  width: 100%;
  min-height: 185px;
  overflow-x: auto;
}

.analytics-bars-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.analytics-bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
}

.analytics-bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.analytics-bar-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--bg-surface-alt);
  overflow: hidden;
}

.analytics-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #136844, #22c55e);
}

.dlp-findings-list {
  margin: 0;
  padding: 10px 14px 10px 26px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--text-primary);
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 900px) {
  .admin-workspace-shell {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .admin-nav.system-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
  }
  .admin-nav-group-title {
    display: none;
  }
  .admin-tab-btn.system-sidebar-item {
    width: auto;
  }
  .modal-card.login-card-split {
    grid-template-columns: 1fr;
  }
  .atis-login-brand {
    display: none;
  }
  .portal-nav,
  .portal-header-clock {
    display: none;
  }
}

@media (max-width: 768px) {
  #chat-sidebar {
    position: fixed;
    left: 10px;
    top: 66px;
    bottom: 10px;
    box-shadow: var(--shadow-elevated);
  }
  .starter-grid {
    grid-template-columns: 1fr;
  }
  .user-bubble-wrap {
    max-width: 92%;
  }
  .composer-card {
    border-radius: 18px;
    padding: 10px 11px 9px 12px;
  }
  .composer-toolbar {
    flex-wrap: wrap;
  }
  .custom-model-btn {
    max-width: 175px;
  }
  .custom-effort-flyout {
    width: 148px;
  }
}

/* Attachment Vision Compatibility Banner & Admin Capability Pills */
.attachment-vision-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  margin-bottom: 6px;
  border-radius: 9px;
  font-size: 11.5px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #b45309;
}

html[data-theme="dark"] .attachment-vision-warning {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.32);
}

.attachment-vision-warning.hidden {
  display: none;
}

.attachment-vision-switch-btn {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.40);
  background: rgba(16, 185, 129, 0.14);
  color: var(--primary-700);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

html[data-theme="dark"] .attachment-vision-switch-btn {
  color: #34d399;
}

.attachment-vision-switch-btn:hover {
  background: rgba(16, 185, 129, 0.24);
}

.adm-cap-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 245px;
}

.adm-cap-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-alt);
  color: var(--text-secondary);
  white-space: nowrap;
}

.adm-cap-pill.is-vision {
  color: #047857;
  background: rgba(16, 185, 129, 0.11);
  border-color: rgba(16, 185, 129, 0.28);
}

.adm-cap-pill.is-reasoning {
  color: #6d28d9;
  background: rgba(139, 92, 246, 0.11);
  border-color: rgba(139, 92, 246, 0.28);
}

.adm-cap-pill.is-tools {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.10);
  border-color: rgba(59, 130, 246, 0.25);
}

.adm-cap-pill.is-off {
  opacity: 0.62;
}

html[data-theme="dark"] .adm-cap-pill.is-vision { color: #34d399; }
html[data-theme="dark"] .adm-cap-pill.is-reasoning { color: #c4b5fd; }
html[data-theme="dark"] .adm-cap-pill.is-tools { color: #93c5fd; }

.adm-cap-pill.is-banned {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.28);
  text-decoration: line-through;
}

html[data-theme="dark"] .adm-cap-pill.is-banned {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.16);
}

.adm-cap-edit-btn {
  margin-top: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.adm-cap-edit-btn:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(16, 185, 129, 0.40);
  color: var(--text-primary);
}

/* Composer Agent Restricted State */
.composer-tool-btn.is-model-restricted {
  opacity: 0.68;
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.22);
}

html[data-theme="dark"] .composer-tool-btn.is-model-restricted {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.26);
}

/* Row Info Icon (i) & Hover Capabilities Popover */
.custom-model-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  color: var(--text-muted);
  opacity: 0.72;
  flex-shrink: 0;
  cursor: help;
  transition: opacity var(--transition-fast), color var(--transition-fast), background-color var(--transition-fast);
}

.custom-model-info-btn:hover,
.custom-model-info-btn:focus-visible,
.custom-model-info-btn.is-active {
  opacity: 1;
  color: #136844;
  background: rgba(16, 185, 129, 0.12);
}

html[data-theme="dark"] .custom-model-info-btn:hover,
html[data-theme="dark"] .custom-model-info-btn:focus-visible,
html[data-theme="dark"] .custom-model-info-btn.is-active {
  color: #34d399;
  background: rgba(16, 185, 129, 0.18);
}

.custom-model-row-locked {
  font-size: 10px;
  font-weight: 600;
  color: #dc2626;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: 999px;
  padding: 1px 6px;
  flex-shrink: 0;
}

html[data-theme="dark"] .custom-model-row-locked {
  color: #fca5a5;
}

/* Floating Model Capabilities Popover on (i) Hover */
.custom-model-info-popover {
  position: absolute;
  width: 226px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 38px -10px rgba(15, 23, 42, 0.22), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  z-index: 98;
  display: flex;
  flex-direction: column;
  gap: 7px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-6px) scale(0.97);
  transition: opacity 0.16s ease, transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.16s;
}

.custom-model-info-popover.flip-left {
  transform: translateX(6px) scale(0.97);
}

html[data-theme="dark"] .custom-model-info-popover {
  background: rgba(24, 31, 44, 0.97);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.65);
}

.custom-model-info-popover.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

.custom-model-info-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-primary);
}

.custom-model-info-head strong {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-model-info-prov {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.custom-model-info-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 10.5px;
}

.custom-model-info-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

.custom-model-cap-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-alt);
  color: var(--text-secondary);
}

.custom-model-cap-badge.is-ok {
  color: #047857;
  background: rgba(16, 185, 129, 0.10);
  border-color: rgba(16, 185, 129, 0.24);
}

.custom-model-cap-badge.is-effort {
  color: #6d28d9;
  background: rgba(139, 92, 246, 0.10);
  border-color: rgba(139, 92, 246, 0.24);
}

.custom-model-cap-badge.is-banned {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.24);
}

.custom-model-cap-badge.is-off {
  opacity: 0.72;
}

html[data-theme="dark"] .custom-model-cap-badge.is-ok { color: #34d399; }
html[data-theme="dark"] .custom-model-cap-badge.is-effort { color: #c4b5fd; }
html[data-theme="dark"] .custom-model-cap-badge.is-banned { color: #fca5a5; }

/* Admin Model Capabilities Modal */
.caps-api-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin: 8px 0 4px;
}

.caps-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.caps-section-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
}

.caps-seg-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.caps-seg-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}

.caps-seg-option:has(input:checked) {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.10);
  color: var(--primary-700);
  font-weight: 600;
}

html[data-theme="dark"] .caps-seg-option:has(input:checked) {
  color: #34d399;
  background: rgba(16, 185, 129, 0.18);
}

.caps-seg-option input {
  accent-color: #10b981;
}

.caps-degree-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  border-radius: 9px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
}

.caps-degree-grid.hidden {
  display: none;
}

.caps-degree-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-primary);
  cursor: pointer;
}

.caps-degree-chip input {
  accent-color: #7c3aed;
}

@media (max-width: 560px) {
  .caps-seg-row {
    grid-template-columns: 1fr;
  }
  .caps-degree-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==================== COMPOSER '+' MENU POPUP ==================== */
.composer-plus-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.composer-plus-btn {
  position: relative;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

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

.composer-plus-btn.open {
  background-color: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.28);
  color: var(--primary-700);
}

html[data-theme="dark"] .composer-plus-btn.open {
  color: #34d399;
  background-color: rgba(16, 185, 129, 0.18);
}

.composer-plus-icon {
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.composer-plus-btn.open .composer-plus-icon {
  transform: rotate(45deg);
}

.composer-plus-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: min(266px, calc(100vw - 28px));
  padding: 6px;
  border-radius: 15px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px -10px rgba(15, 23, 42, 0.22), 0 6px 14px -4px rgba(15, 23, 42, 0.08);
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom left;
  transition: opacity 0.18s cubic-bezier(0.22, 1, 0.36, 1), transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.18s;
}

html[data-theme="dark"] .composer-plus-menu {
  background: rgba(28, 33, 44, 0.97);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.65);
}

.composer-plus-menu.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.composer-plus-item {
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.composer-plus-item:hover {
  background-color: var(--bg-surface-hover);
}

.composer-plus-item-left {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--text-secondary);
}

.composer-plus-item:hover .composer-plus-item-left {
  color: var(--text-primary);
}

.composer-plus-item.active .composer-plus-item-left svg {
  color: #16a34a;
}

html[data-theme="dark"] .composer-plus-item.active .composer-plus-item-left svg {
  color: #34d399;
}

.composer-plus-item.is-model-restricted {
  color: #b91c1c;
}

.composer-plus-item.is-model-restricted .composer-plus-item-left {
  color: #b91c1c;
}

html[data-theme="dark"] .composer-plus-item.is-model-restricted,
html[data-theme="dark"] .composer-plus-item.is-model-restricted .composer-plus-item-left {
  color: #fca5a5;
}

.composer-plus-item-right {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.composer-plus-val {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.composer-plus-divider {
  height: 1px;
  margin: 3px 6px;
  background: var(--border-subtle);
}

.composer-plus-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 9px 3px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ==================== CONVERSATION TIMELINE MINIMAP (ANTIGRAVITY STYLE) ==================== */
.chat-minimap {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  max-height: calc(100% - 140px);
  padding: 8px 3px;
  overflow-y: auto;
  scrollbar-width: none;
}

.chat-minimap::-webkit-scrollbar {
  display: none;
}

.chat-minimap.hidden {
  display: none;
}

.chat-minimap-btn {
  width: 18px;
  min-height: 11px;
  padding: 3px 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-minimap-pip {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--text-muted);
  opacity: 0.34;
  transition: width 0.16s ease, height 0.16s ease, opacity 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.chat-minimap-btn.is-tall .chat-minimap-pip {
  width: 3px;
  height: 10px;
  opacity: 0.40;
}

.chat-minimap-btn.is-in-view .chat-minimap-pip {
  opacity: 0.68;
}

.chat-minimap-btn.is-active .chat-minimap-pip {
  width: 6.5px;
  height: 6.5px;
  opacity: 1;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

html[data-theme="dark"] .chat-minimap-btn.is-active .chat-minimap-pip {
  background: #f1f5f9;
  box-shadow: 0 0 0 3px rgba(241, 245, 249, 0.18);
}

.chat-minimap-btn:hover .chat-minimap-pip,
.chat-minimap-btn:focus-visible .chat-minimap-pip {
  opacity: 1;
  transform: scale(1.45);
  background: #136844;
}

html[data-theme="dark"] .chat-minimap-btn:hover .chat-minimap-pip,
html[data-theme="dark"] .chat-minimap-btn:focus-visible .chat-minimap-pip {
  background: #34d399;
}

.chat-minimap-tooltip {
  position: absolute;
  left: 34px;
  max-width: min(260px, calc(100% - 56px));
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.18), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
  z-index: 25;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.14s ease, transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--text-primary);
}

html[data-theme="dark"] .chat-minimap-tooltip {
  background: rgba(24, 31, 44, 0.96);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}

.chat-minimap-tooltip.open {
  opacity: 1;
  transform: translateX(0);
}

.chat-minimap-tip-idx {
  font-size: 10.5px;
  font-weight: 700;
  color: #136844;
  flex-shrink: 0;
}

html[data-theme="dark"] .chat-minimap-tip-idx {
  color: #34d399;
}

.chat-minimap-tip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes minimapTargetFlash {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.16); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.message.minimap-target-flash .user-bubble-wrap {
  border-radius: 18px;
  animation: minimapTargetFlash 0.9s ease;
}

@media (max-width: 1140px) {
  #chat-section.has-minimap #chat-container {
    padding-left: 34px;
  }
}

@media (max-width: 768px) {
  .chat-minimap,
  .chat-minimap-tooltip {
    display: none !important;
  }
}

/* ==================== SCROLL TO BOTTOM & VOICE CONTROLS ==================== */
.scroll-bottom-btn {
  position: absolute;
  top: -42px;
  left: 50%;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  box-shadow: 0 8px 22px -6px rgba(15, 23, 42, 0.22);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(6px) scale(0.92);
  transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.18s, background-color 0.15s ease, top 0.2s ease;
}

html[data-theme="dark"] .scroll-bottom-btn {
  background: rgba(39, 44, 56, 0.92);
  border-color: rgba(148, 163, 184, 0.24);
  color: #f1f5f9;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
}

.scroll-bottom-btn.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

.scroll-bottom-btn.visible:hover {
  background: var(--bg-surface-hover);
  transform: translateX(-50%) translateY(-1px) scale(1.04);
}

.scroll-bottom-btn.with-stop {
  top: -80px;
}

.voice-mic-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.voice-mic-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

.voice-mic-btn.is-listening {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

html[data-theme="dark"] .voice-mic-btn.is-listening {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.18);
}

.voice-call-btn {
  width: 31px;
  height: 31px;
  margin-left: 2px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: #0f172a;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}

html[data-theme="dark"] .voice-call-btn {
  background: #f8fafc;
  color: #0f172a;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.voice-call-btn:hover {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.24);
}

.voice-call-btn.hidden,
#send-button.hidden {
  display: none !important;
}

/* ==================== GLOBAL UTILITIES & CHATGPT VOICE MODE ==================== */
.hidden {
  display: none !important;
}

.voice-mode-backdrop {
  padding: 0 !important;
  background: radial-gradient(circle at 50% 44%, rgba(224, 242, 254, 0.45), #ffffff 62%) !important;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

html[data-theme="dark"] .voice-mode-backdrop {
  background: radial-gradient(circle at 50% 44%, rgba(12, 34, 58, 0.72), #0d0f14 64%) !important;
}

.voice-stage {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 24px 32px;
  animation: fadeIn 0.22s ease;
  overflow-y: auto;
}

.voice-stage-top {
  width: 100%;
  max-width: 820px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 40px;
}

.voice-stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.045);
  border: 1px solid rgba(15, 23, 42, 0.07);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
}

.voice-stage-pill--btn {
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.14s ease;
}

.voice-stage-pill--btn:hover,
.voice-stage-pill--btn.is-open {
  background: rgba(15, 23, 42, 0.08);
  color: var(--text-primary);
  border-color: rgba(15, 23, 42, 0.14);
}

.voice-stage-pill-chevron {
  opacity: 0.72;
  transition: transform 0.18s ease;
}

.voice-stage-pill--btn.is-open .voice-stage-pill-chevron {
  transform: rotate(180deg);
}

html[data-theme="dark"] .voice-stage-pill {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

html[data-theme="dark"] .voice-stage-pill--btn:hover,
html[data-theme="dark"] .voice-stage-pill--btn.is-open {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.voice-model-menu {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  max-width: 92vw;
  max-height: 310px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(18px);
  z-index: 22;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: fadeIn 0.15s ease;
}

html[data-theme="dark"] .voice-model-menu {
  background: rgba(24, 28, 38, 0.96);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.voice-model-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.voice-model-item:hover {
  background: rgba(15, 23, 42, 0.06);
}

html[data-theme="dark"] .voice-model-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.voice-model-item.is-selected {
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
  font-weight: 600;
}

html[data-theme="dark"] .voice-model-item.is-selected {
  background: rgba(14, 165, 233, 0.18);
  color: #7dd3fc;
}

.voice-model-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-model-item-check {
  flex-shrink: 0;
  font-size: 0.85rem;
}

.voice-stage-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.75);
}

.voice-stage-top-actions {
  position: absolute;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.voice-stage-icon-btn,
.voice-stage-close-x {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(15, 23, 42, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.voice-stage-icon-btn.is-open {
  background: rgba(14, 165, 233, 0.14);
  border-color: rgba(14, 165, 233, 0.36);
  color: #0284c7;
}

html[data-theme="dark"] .voice-stage-icon-btn,
html[data-theme="dark"] .voice-stage-close-x {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

html[data-theme="dark"] .voice-stage-icon-btn.is-open {
  background: rgba(14, 165, 233, 0.24);
  color: #7dd3fc;
}

.voice-stage-icon-btn:hover,
.voice-stage-close-x:hover {
  background: rgba(15, 23, 42, 0.09);
  color: var(--text-primary);
  transform: scale(1.06);
}

html[data-theme="dark"] .voice-stage-icon-btn:hover,
html[data-theme="dark"] .voice-stage-close-x:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.voice-settings-popover {
  position: absolute;
  top: 48px;
  right: 0;
  width: 300px;
  max-width: 92vw;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(18px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  animation: fadeIn 0.15s ease;
}

html[data-theme="dark"] .voice-settings-popover {
  background: rgba(24, 28, 38, 0.96);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.voice-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
}

.voice-settings-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.voice-settings-close:hover {
  background: rgba(15, 23, 42, 0.07);
  color: var(--text-primary);
}

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

.voice-setting-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.voice-setting-value {
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.voice-setting-range {
  width: 100%;
  accent-color: #0ea5e9;
  cursor: pointer;
}

.voice-setting-select {
  width: 100%;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.78rem;
  outline: none;
}

.voice-setting-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
}

.voice-setting-switch input {
  width: 16px;
  height: 16px;
  accent-color: #0ea5e9;
  cursor: pointer;
}

.voice-settings-test-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(14, 165, 233, 0.34);
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

html[data-theme="dark"] .voice-settings-test-btn {
  color: #7dd3fc;
}

.voice-settings-test-btn:hover {
  background: rgba(14, 165, 233, 0.18);
}

.voice-send-now-btn {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(14, 165, 233, 0.36);
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

html[data-theme="dark"] .voice-send-now-btn {
  color: #7dd3fc;
}

.voice-send-now-btn:hover {
  background: rgba(14, 165, 233, 0.22);
  transform: scale(1.03);
}

.voice-stage-center {
  flex: 1;
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  text-align: center;
}

/* Signature ChatGPT Sky-Blue Living Cloud Sphere */
.voice-orb-wrap {
  position: relative;
  width: 244px;
  height: 244px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-orb {
  position: relative;
  width: 196px;
  height: 196px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: voiceFloat 6s ease-in-out infinite;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.voice-orb::before {
  content: "";
  position: absolute;
  inset: -26px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.24), rgba(14, 165, 233, 0.09) 55%, transparent 74%);
  filter: blur(18px);
  z-index: 0;
  transition: background 0.4s ease, transform 0.4s ease;
}

.voice-orb-core {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.94) 0%, rgba(224, 242, 254, 0.45) 28%, transparent 58%),
    radial-gradient(circle at 74% 78%, rgba(2, 132, 199, 0.88) 0%, transparent 62%),
    radial-gradient(circle at 22% 76%, rgba(56, 189, 248, 0.9) 0%, transparent 60%),
    linear-gradient(155deg, #bae6fd 0%, #60c5ff 42%, #1d8fe1 78%, #0284c7 100%);
  box-shadow:
    inset 0 -22px 38px rgba(3, 105, 161, 0.38),
    inset 0 18px 34px rgba(255, 255, 255, 0.78),
    0 24px 60px -14px rgba(14, 165, 233, 0.46);
  animation: voiceMorph 8s ease-in-out infinite;
}

.voice-orb-cloud {
  position: absolute;
  inset: -30%;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.72) 0%, transparent 45%),
    radial-gradient(circle at 68% 62%, rgba(125, 211, 252, 0.72) 0%, transparent 48%),
    radial-gradient(circle at 32% 72%, rgba(3, 105, 161, 0.48) 0%, transparent 50%);
  filter: blur(18px);
  animation: voiceCloudSpin 14s linear infinite;
}

.voice-orb-halo {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 189, 248, 0.34);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform: scale(0.95);
}

@keyframes voiceFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.015); }
}

@keyframes voiceMorph {
  0%, 100% { border-radius: 50% 50% 49% 51% / 51% 49% 51% 49%; }
  33% { border-radius: 48% 52% 51% 49% / 49% 52% 48% 51%; }
  66% { border-radius: 52% 48% 49% 51% / 51% 48% 52% 49%; }
}

@keyframes voiceCloudSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes voiceWaveListen {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

@keyframes voiceSpeakOrganic {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.08); }
  50% { transform: scale(1.02); }
  75% { transform: scale(1.1); }
}

@keyframes voiceHaloRipple {
  0% {
    opacity: 0.72;
    transform: scale(0.98);
  }
  100% {
    opacity: 0;
    transform: scale(1.46);
  }
}

.voice-orb.is-listening .voice-orb-core {
  animation: voiceMorph 3.2s ease-in-out infinite, voiceWaveListen 1.25s ease-in-out infinite;
  box-shadow:
    inset 0 -20px 36px rgba(3, 105, 161, 0.34),
    inset 0 16px 32px rgba(255, 255, 255, 0.85),
    0 0 0 12px rgba(56, 189, 248, 0.16),
    0 28px 66px -10px rgba(14, 165, 233, 0.56);
}

.voice-orb.is-listening .voice-orb-cloud {
  animation: voiceCloudSpin 6.5s linear infinite;
}

.voice-orb.is-thinking::before {
  background: radial-gradient(circle, rgba(59, 130, 246, 0.3), rgba(99, 102, 241, 0.14) 55%, transparent 74%);
}

.voice-orb.is-thinking .voice-orb-core {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.9) 0%, transparent 50%),
    radial-gradient(circle at 72% 75%, rgba(79, 70, 229, 0.72) 0%, transparent 62%),
    linear-gradient(155deg, #c7d2fe 0%, #60a5fa 46%, #2563eb 100%);
  animation: voiceMorph 2.8s ease-in-out infinite;
}

.voice-orb.is-thinking .voice-orb-cloud {
  animation: voiceCloudSpin 3.2s linear infinite;
}

.voice-orb.is-speaking::before {
  background: radial-gradient(circle, rgba(14, 165, 233, 0.38), rgba(56, 189, 248, 0.18) 55%, transparent 74%);
}

.voice-orb.is-speaking .voice-orb-core {
  animation: voiceMorph 2.1s ease-in-out infinite, voiceSpeakOrganic 0.95s ease-in-out infinite;
  box-shadow:
    inset 0 -18px 36px rgba(3, 105, 161, 0.35),
    inset 0 18px 36px rgba(255, 255, 255, 0.88),
    0 0 0 14px rgba(56, 189, 248, 0.18),
    0 30px 72px -10px rgba(2, 132, 199, 0.58);
}

.voice-orb.is-speaking .voice-orb-cloud {
  animation: voiceCloudSpin 4.4s linear infinite;
}

.voice-orb.is-listening .voice-orb-halo,
.voice-orb.is-speaking .voice-orb-halo,
.voice-orb.is-thinking .voice-orb-halo {
  animation: voiceHaloRipple 2.1s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

.voice-orb.is-listening .voice-orb-halo--2,
.voice-orb.is-speaking .voice-orb-halo--2,
.voice-orb.is-thinking .voice-orb-halo--2 {
  animation-delay: 1.05s;
}

.voice-orb.is-speaking .voice-orb-halo {
  border-color: rgba(14, 165, 233, 0.52);
  animation-duration: 1.45s;
}

.voice-orb.is-speaking .voice-orb-halo--2 {
  animation-delay: 0.72s;
}

.voice-orb.is-thinking .voice-orb-halo {
  border-color: rgba(99, 102, 241, 0.42);
}

.voice-mode-status {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.voice-mode-transcript {
  width: 100%;
  max-width: 500px;
  max-height: 118px;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.voice-mode-transcript:not(:empty) {
  padding: 10px 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.035);
  border: 1px solid rgba(15, 23, 42, 0.06);
  color: var(--text-primary);
}

html[data-theme="dark"] .voice-mode-transcript:not(:empty) {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.09);
}

.voice-mode-transcript:empty {
  display: none;
}

.voice-mode-notice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  max-width: 520px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.045);
  border: 1px solid rgba(15, 23, 42, 0.09);
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.35;
}

html[data-theme="dark"] .voice-mode-notice {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

.voice-notice-copy-btn {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(14, 165, 233, 0.35);
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
  font-family: inherit;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

html[data-theme="dark"] .voice-notice-copy-btn {
  color: #7dd3fc;
}

.voice-notice-copy-btn:hover {
  background: rgba(14, 165, 233, 0.18);
}

.voice-bottom-bar {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.voice-mode-text-form {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 8px 24px -10px rgba(15, 23, 42, 0.12);
}

html[data-theme="dark"] .voice-mode-text-form {
  background: rgba(30, 34, 44, 0.88);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.36);
}

.voice-mode-text-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.voice-mode-text-input::placeholder {
  color: var(--text-muted);
}

.voice-mode-text-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #18181b;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

html[data-theme="dark"] .voice-mode-text-send {
  background: #ffffff;
  color: #111827;
}

.voice-mode-text-send:hover {
  transform: scale(1.06);
}

.voice-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 4px 12px;
}

.voice-dock-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #f4f4f5;
  color: #18181b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.16s ease, box-shadow 0.18s ease, color 0.16s ease;
}

html[data-theme="dark"] .voice-dock-btn {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

.voice-dock-btn:hover {
  transform: scale(1.06);
  background: #e4e4e7;
}

html[data-theme="dark"] .voice-dock-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.voice-dock-btn--main {
  width: 64px;
  height: 64px;
  border: none;
  background: #18181b;
  color: #ffffff;
  box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.34);
}

.voice-dock-btn--main:hover {
  background: #27272a;
}

html[data-theme="dark"] .voice-dock-btn--main {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .voice-dock-btn--main:hover {
  background: #e2e8f0;
}

.voice-dock-btn--main.is-active {
  background: #0ea5e9;
  color: #ffffff;
  box-shadow: 0 0 0 6px rgba(14, 165, 233, 0.22), 0 14px 30px -6px rgba(14, 165, 233, 0.45);
}

.voice-dock-btn.is-muted {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
  color: #dc2626;
}

html[data-theme="dark"] .voice-dock-btn.is-muted {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.voice-dock-btn--end {
  background: #fee2e2;
  border-color: rgba(239, 68, 68, 0.16);
  color: #dc2626;
}

html[data-theme="dark"] .voice-dock-btn--end {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.28);
  color: #fca5a5;
}

.voice-dock-btn--end:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

/* Message Footer Read Aloud Active State */
.msg-action-btn.is-speaking-active {
  background: rgba(14, 165, 233, 0.13);
  border-color: rgba(14, 165, 233, 0.44);
  color: #0284c7;
}

html[data-theme="dark"] .msg-action-btn.is-speaking-active {
  background: rgba(14, 165, 233, 0.22);
  border-color: rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
}

.msg-action-btn.is-speaking-active svg {
  animation: voiceIconPulse 1.15s ease-in-out infinite;
}

@keyframes voiceIconPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.16); opacity: 0.72; }
}

@media (max-width: 560px) {
  .voice-orb-wrap {
    width: 196px;
    height: 196px;
  }
  .voice-orb {
    width: 158px;
    height: 158px;
  }
}
