/* ==========================================================================
   Google Gemini 官方現代風格樣式表
   深邃色調、極簡毛玻璃、官方色漸層與全版側邊欄配置
   ========================================================================== */

:root {
  --bg-app: #131314;
  --bg-sidebar: #1e1f20;
  --bg-sidebar-hover: #282a2c;
  --bg-sidebar-active: #333538;
  --bg-input: #1e1f20;
  --bg-card: #1e1f20;
  --bg-card-hover: #282a2c;
  --bg-bubble-ai: transparent;
  --bg-bubble-user: #282a2c;

  --text-primary: #e3e3e3;
  --text-secondary: #c4c7c5;
  --text-muted: #8e918f;
  --text-dim: #444746;

  --border-color: #444746;
  --border-subtle: rgba(255, 255, 255, 0.08);

  --color-blue: #a8c7fa;
  --color-blue-btn: #1a73e8;
  --gemini-gradient: linear-gradient(74deg, #4285f4 0%, #9b72cb 35%, #d96570 70%, #1e8e3e 100%);
  --gemini-glow: radial-gradient(circle at 50% 50%, rgba(66, 133, 244, 0.15), transparent 70%);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  --font-sans: 'Google Sans', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body.gemini-theme {
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
}

/* 隱藏元素輔助類別 */
.hidden {
  display: none !important;
}

/* ==================== 1. 登入視窗樣式 ==================== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background-color: var(--bg-app);
  background-image: 
    radial-gradient(ellipse at top left, rgba(66, 133, 244, 0.12), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(155, 114, 203, 0.12), transparent 50%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.login-card {
  background: rgba(18, 20, 29, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 28px;
  padding: 44px 36px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(56, 189, 248, 0.12);
  backdrop-filter: blur(25px);
  text-align: center;
  animation: fadeInModal 0.3s ease-out;
  position: relative;
  overflow: hidden;
}

@keyframes fadeInModal {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==================== 專屬帥氣暗黑狼魂圖標 (非市面任何 AI) ==================== */
.wolf-core-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 18px;
}

.wolf-crest {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-space, radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, rgba(129, 140, 248, 0.1) 70%, transparent 100%);
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.35), inset 0 0 15px rgba(129, 140, 248, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: crestPulse 3s infinite alternate ease-in-out;
}

@keyframes crestPulse {
  0% { transform: scale(1); box-shadow: 0 0 15px rgba(56, 189, 248, 0.3); }
  100% { transform: scale(1.06); box-shadow: 0 0 28px rgba(192, 132, 252, 0.5); }
}

.wolf-icon {
  font-size: 34px !important;
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #f43f5e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-core-crest {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
}

.core-hexagon {
  width: 68px;
  height: 68px;
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.core-symbol {
  font-size: 40px !important;
  color: #38bdf8;
  filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.6));
}

.custom-wolf-avatar {
  background: rgba(15, 23, 42, 0.9) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2) !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wolf-avatar-icon {
  font-size: 18px !important;
  color: #38bdf8;
}

.login-title {
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.5px;
  background: var(--gemini-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.login-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 28px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
}

.form-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  margin-left: 4px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background-color: #131314;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.input-wrapper:focus-within {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.2);
}

.input-wrapper input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 14px 14px 14px 44px;
  font-size: 0.95rem;
  outline: none;
}

.input-wrapper .input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 20px;
  pointer-events: none;
}

.toggle-pwd {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 12px;
  display: flex;
  align-items: center;
}

.toggle-pwd:hover {
  color: var(--text-primary);
}

.login-error {
  background: rgba(217, 101, 112, 0.15);
  border: 1px solid rgba(217, 101, 112, 0.4);
  color: #f28b82;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  text-align: left;
}

.btn-primary {
  background: var(--gemini-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s, transform 0.15s;
  margin-top: 8px;
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.login-hint {
  margin-top: 24px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
  text-align: left;
}

.login-hint p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hint-badges {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.badge {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--color-blue);
  cursor: pointer;
  transition: background 0.15s;
}

.badge:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ==================== 2. Gemini 主應用容器 ==================== */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  background-color: var(--bg-app);
}

/* ---------- 側邊欄樣式 ---------- */
.gemini-sidebar {
  width: 280px;
  height: 100%;
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid var(--border-subtle);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s ease;
  z-index: 100;
}

.gemini-sidebar.collapsed {
  width: 72px;
}

.sidebar-header {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.brand-text {
  font-size: 1.25rem;
  font-weight: 500;
  background: var(--gemini-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}

.gemini-sidebar.collapsed .brand-text {
  display: none;
}

/* 開啟新對話按鈕 */
.new-chat-container {
  padding: 8px 14px 16px 14px;
}

.btn-new-chat {
  width: 100%;
  height: 48px;
  background-color: #1a1a1c;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.btn-new-chat:hover {
  background-color: var(--bg-sidebar-hover);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.gemini-sidebar.collapsed .btn-new-chat {
  justify-content: center;
  padding: 0;
  width: 44px;
  height: 44px;
  margin: 0 auto;
}

.gemini-sidebar.collapsed .btn-new-chat .btn-label {
  display: none;
}

/* 歷史記錄清單 */
.chat-history-section {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
}

.history-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  padding: 8px 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gemini-sidebar.collapsed .history-label {
  display: none;
}

.chat-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
  user-select: none;
}

.history-item:hover {
  background-color: var(--bg-sidebar-hover);
  color: var(--text-primary);
}

.history-item.active {
  background-color: #004a77;
  color: #c2e7ff;
  font-weight: 500;
}

.history-item .item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.history-item .item-delete-btn {
  opacity: 0;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 50%;
  transition: opacity 0.15s, background 0.15s;
}

.history-item:hover .item-delete-btn {
  opacity: 0.75;
}

.history-item .item-delete-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.gemini-sidebar.collapsed .chat-history-section {
  display: none;
}

/* 側邊欄底部 */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.03);
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285f4, #9b72cb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

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

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

.user-role {
  font-size: 0.72rem;
  color: var(--color-blue);
}

.logout-btn {
  color: var(--text-muted);
}

.logout-btn:hover {
  color: #f28b82;
}

.gemini-sidebar.collapsed .user-meta {
  display: none;
}

/* ---------- 右側主對話區域 ---------- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  background-color: var(--bg-app);
  overflow: hidden;
}

/* 頂部導航列 */
.main-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  border-bottom: 1px solid transparent;
}

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

.model-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: default;
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-indicator.online .status-dot {
  width: 8px;
  height: 8px;
  background-color: #34a853;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(52, 168, 83, 0.6);
}

/* 通用圖示按鈕 */
.icon-button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-button:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* 捲軸美化全域設定 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* 對話串視窗 */
.chat-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  padding-bottom: 30px;
}

/* 歡迎畫面 (Gemini Hero) */
.welcome-screen {
  max-width: 820px;
  margin: auto;
  padding: 40px 24px 20px 24px;
  width: 100%;
}

.welcome-sparkle .hero-sparkle {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
}

.welcome-title {
  font-size: 3.2rem;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -1px;
}

.gradient-text {
  background: var(--gemini-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
  font-size: 2.8rem;
  font-weight: 500;
  color: #444746;
  line-height: 1.15;
  margin-bottom: 48px;
}

/* 靈感提示詞卡片網格 */
.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.suggestion-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-card:hover {
  background-color: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.suggestion-card .card-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.suggestion-card .card-icon {
  align-self: flex-end;
  color: var(--text-muted);
  font-size: 24px;
}

/* 訊息串列表 */
.messages-list {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 24px 10px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.message-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  animation: fadeInMsg 0.25s ease-out;
}

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

/* 使用者訊息 */
.message-row.user-row {
  justify-content: flex-end;
}

.message-row.user-row .message-bubble {
  background-color: var(--bg-bubble-user);
  border-radius: 20px 20px 4px 20px;
  padding: 14px 20px;
  max-width: 85%;
  font-size: 0.98rem;
  line-height: 1.55;
  color: #fff;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Gemini 回覆 */
.message-row.gemini-row {
  justify-content: flex-start;
}

.gemini-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gemini-avatar svg {
  width: 28px;
  height: 28px;
}

.message-row.gemini-row .message-bubble {
  flex: 1;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  word-break: break-word;
  padding-top: 4px;
}

/* Markdown 排版樣式 */
.message-bubble p {
  margin-bottom: 12px;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble ul, .message-bubble ol {
  margin-left: 24px;
  margin-bottom: 12px;
}

.message-bubble li {
  margin-bottom: 4px;
}

.message-bubble code {
  font-family: 'Consolas', 'Courier New', monospace;
  background-color: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  color: #a8c7fa;
}

.message-bubble pre {
  margin: 12px 0;
  border-radius: 12px;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  background-color: #1e1f20;
}

.message-bubble pre code {
  display: block;
  padding: 14px 18px;
  background: transparent;
  color: #f1f5f9;
  font-size: 0.9rem;
}

/* 思考中動畫 (Gemini Shimmer) */
.thinking-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.thinking-sparkle {
  width: 20px;
  height: 20px;
  animation: spinSlow 3s linear infinite;
}

@keyframes spinSlow {
  100% { transform: rotate(360deg); }
}

.thinking-bar {
  font-size: 0.92rem;
  background: linear-gradient(90deg, #4285f4, #9b72cb, #d96570, #4285f4);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 1.8s linear infinite;
}

@keyframes shimmer {
  to { background-position: 200% center; }
}

/* ---------- 底部輸入錨點 (Input Dock) ---------- */
.input-dock {
  flex-shrink: 0;
  padding: 10px 24px 20px 24px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.input-container {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 28px;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s;
}

.input-container:focus-within {
  border-color: rgba(255, 255, 255, 0.25);
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-form textarea {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 180px;
  min-height: 24px;
  padding: 4px 2px;
}

.chat-form textarea::placeholder {
  color: var(--text-muted);
}

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-send {
  background-color: #fff;
  border: none;
  color: #131314;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}

.btn-send:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  background-color: var(--text-dim);
  color: var(--text-muted);
}

.btn-send:not(:disabled):hover {
  transform: scale(1.05);
}

.footer-legal {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 10px;
}

/* 行動裝置選單開關 */
.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .mobile-only {
    display: flex;
  }
  .gemini-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
  }
  .gemini-sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 90;
  }
  .welcome-title {
    font-size: 2.2rem;
  }
  .welcome-subtitle {
    font-size: 1.8rem;
  }
  .suggestion-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Boss 專屬問答監控與編輯面板樣式
   ========================================================================== */
.boss-qa-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #1e1e24;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.boss-qa-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.boss-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.boss-modal-content {
  background: #18191f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 960px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.boss-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: #131318;
}

.boss-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.boss-header-title h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #f1f5f9;
}

.boss-badge {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.boss-modal-filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: #18191f;
}

.boss-modal-filter-bar select {
  background: #25262e;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 0.9rem;
  outline: none;
}

/* Boss 視圖容器：確保 flex 彈性撐滿且不溢出父容器，讓內部 table-container 產生正常捲軸 */
.boss-view-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.search-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #25262e;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  flex: 1;
}

.search-group input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  width: 100%;
  outline: none;
}

.boss-table-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.boss-qa-item {
  background: #202128;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}

.boss-qa-item:hover {
  border-color: rgba(168, 199, 250, 0.3);
}

.boss-qa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.8rem;
}

.boss-qa-tags {
  display: flex;
  gap: 8px;
}

.tag {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
}

.user-tag { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.role-user-tag { background: rgba(168, 199, 250, 0.15); color: #a8c7fa; }
.role-model-tag { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.session-tag { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }

.boss-btn-edit {
  background: transparent;
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.boss-btn-edit:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
}

.boss-qa-content {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* 子彈窗：直接編輯問答 */
.boss-sub-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.boss-sub-modal-content {
  background: #1d1e26;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  padding: 20px 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.boss-sub-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.boss-sub-modal-header h4 {
  color: #f59e0b;
  font-size: 1.1rem;
}

.boss-sub-modal-body textarea {
  width: 100%;
  background: #131318;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  margin-top: 8px;
  outline: none;
}

.boss-sub-modal-body textarea:focus {
  border-color: #f59e0b;
}

/* ==================== 註冊與現代酷炫科技/深色介面加強 ==================== */
.auth-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 12px;
  animation: pulseGlow 2s infinite ease-in-out;
}

.cyber-glow-dot {
  width: 7px;
  height: 7px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 10px #38bdf8;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(56, 189, 248, 0.2); }
  50% { box-shadow: 0 0 20px rgba(56, 189, 248, 0.4); }
}

.auth-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: var(--radius-pill);
  gap: 4px;
  margin-bottom: 24px;
  border: 1px solid var(--border-subtle);
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.auth-tab-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.auth-tab-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.badge-boss {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #f59e0b !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}

/* Boss 中樞全新視覺與標籤頁 */
.boss-shield-icon {
  color: #f59e0b;
  font-size: 32px;
  filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.5));
}

.boss-title-wrap {
  display: flex;
  flex-direction: column;
}

.boss-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.boss-header-tabs {
  display: flex;
  gap: 8px;
}

.boss-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.boss-tab-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.boss-tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.boss-users-header-info {
  padding: 12px 24px;
  background: rgba(56, 189, 248, 0.05);
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-size: 0.86rem;
}

/* 使用者卡片與管理列表 */
.boss-user-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.boss-user-item {
  background: #202128;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
}

.boss-user-item:hover {
  border-color: rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
}

.boss-user-item.status-disabled {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.04);
}

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

.user-avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.user-avatar-badge.boss-badge-bg {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.user-details h4 {
  font-size: 1.05rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-meta-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  gap: 12px;
}

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

.status-badge {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.disabled {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-toggle-status {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.btn-toggle-status:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-toggle-status.to-disable:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: #ef4444;
}

.btn-toggle-status.to-active:hover {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: #10b981;
}

.btn-manage-user {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.btn-manage-user:hover {
  background: rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.boss-input {
  width: 100%;
  background: #131318;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 0.92rem;
  outline: none;
  margin-top: 6px;
  transition: border-color 0.2s;
}

.boss-input:focus {
  border-color: #38bdf8;
}

.boss-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-row {
  display: flex;
  gap: 14px;
  margin-top: 12px;
}

.boss-sub-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}
:root { --memory-status-color: #9bc6aa; }
.memory-save-status { min-height: 1.1em; margin: 6px 12px 0; color: var(--memory-status-color); font-size: 12px; text-align: center; }
/* Durable capability controls and mobile attachment toolbar. */
.capability-action { color: #e9f3ff; background: #243c57; border: 1px solid #52759a; border-radius: 8px; padding: 9px 12px; margin: 4px; cursor: pointer; font: inherit; font-size: .86rem; min-height: 40px; }
.capability-action:hover { background: #355774; }
.capability-action:disabled { opacity: .55; cursor: wait; }
#capabilityDialog { margin: auto; line-height: 1.55; }
#capabilityDialog::backdrop { background: #0009; }
#capabilityDialog h2, #capabilityDialog h3 { margin: 12px 0; }
#capabilityDialog p { color: #c5d5e8; margin: 12px 0; }
#capabilityDialog table { border-collapse: collapse; margin: 18px 0; }
#capabilityDialog td { padding: 10px 6px; border-bottom: 1px solid #35455b; }
#capabilityDialog input:not([type=checkbox]), #capabilityDialog select { padding: 8px; color: #f5f7ff; background: #101b2b; border: 1px solid #62758c; border-radius: 6px; max-width: 100%; margin: 4px; }
#capabilityDialog input[type=checkbox] { margin-left: 8px; width: 19px; height: 19px; vertical-align: middle; }
#capabilityDialog details { border: 1px solid #35455b; border-radius: 10px; margin: 10px 0; padding: 12px; }
#capabilityDialog summary { cursor: pointer; font-weight: bold; }
.action-left { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#attachmentSelection, #attachmentLibrary { max-height: 180px; overflow: auto; font-size: .85rem; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  #capabilityDialog { padding: 12px !important; }
  #capabilityDialog td { padding: 8px 3px; font-size: .78rem; }
  .capability-action { margin: 3px; padding: 8px; }
  .boss-header-tabs { flex-wrap: wrap; }
}
