.ai-admin-controls {
  margin: 0 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
}

.ai-admin-controls summary {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  list-style: none;
}

.ai-admin-controls summary .ai-project-icon {
  width: 22px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.ai-admin-controls summary::-webkit-details-marker {
  display: none;
}

.ai-admin-controls summary::marker {
  content: "";
}

.ai-admin-controls-body {
  display: grid;
  gap: 12px;
  padding: 6px 0 14px;
}

.ai-filter-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: end;
}

.ai-filter-bar .field {
  margin-bottom: 0;
  width: 100%;
}

.ai-filter-bar .btn {
  grid-column: 1 / -1;
  justify-self: stretch;
  justify-content: center;
}

.ai-provider-model-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.ai-connection-block.embedded {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.ai-history-pane label,
.ai-history-pane strong,
.ai-history-pane .block-title,
.ai-history-pane .settings-help,
.ai-history-pane .btn,
.ai-history-pane select,
.ai-history-pane input {
  font-weight: 400;
}

.ai-test-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 6px;
}

.ai-test-btn {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
  min-height: 28px;
}

.ai-test-btn:hover {
  background: #1f2937;
  border-color: #1f2937;
}

.connection-test-result {
  display: none;
  margin-top: 8px;
  padding: 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
}

.ai-history-pane {
  position: relative;
  min-width: 0;
  height: calc(100vh - 120px);
  max-height: calc(100vh - 120px);
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 4px 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.ai-mobile-view-switch {
  display: none;
}

.ai-sidebar-edge-toggle {
  position: absolute;
  z-index: 20;
  width: 22px;
  height: 42px;
  border: 1px solid #dbe3ee;
  background: rgba(255, 255, 255, 0.92);
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.ai-sidebar-edge-toggle:hover {
  border-color: #cbd5e1;
  background: #ffffff;
  color: #0f172a;
}

.ai-sidebar-edge-toggle.collapse {
  top: 18px;
  right: -11px;
  border-radius: 999px;
}

.ai-sidebar-edge-toggle.reveal {
  top: 18px;
  left: -11px;
  border-radius: 999px;
}

.ai-history-title {
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.ai-history-list {
  display: grid;
  gap: 6px;
  min-height: 0;
  max-height: none;
  overflow: visible;
  align-content: start;
  align-items: start;
}

.ai-sidebar-scroll-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.ai-history-pane > .ai-history-list {
  flex: initial;
  padding-right: 0;
}

.ai-sidebar-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  margin-bottom: 10px;
}

.ai-sidebar-action {
  min-height: 34px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  padding: 0 4px;
  cursor: pointer;
}

.ai-sidebar-action span {
  display: inline-flex;
  color: #4b5563;
}

.ai-sidebar-action:hover {
  background: #f3f4f6;
  color: var(--ink);
}

.ai-chat-search {
  width: 100%;
  height: 34px;
  margin-bottom: 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  padding: 0 6px;
}

.ai-chat-search:focus {
  outline: 1px solid var(--line-strong);
  background: #ffffff;
}

.ai-chat-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  padding: 4px 4px;
  min-height: 34px;
  border: 0;
  background: transparent;
  min-width: 0; /* 親Gridの自動幅伸縮バグを防ぎ、...省略表示を100%有効化 */
  transition: background-color 0.15s ease;
}

.ai-chat-row:hover {
  background: #f8fafc;
}

.ai-chat-row.active {
  background: #f1f5f9;
}

.ai-chat-row:has(.ai-chat-menu.open),
.ai-project-row:has(.ai-chat-menu.open) {
  z-index: 40;
}

.ai-chat-row.active .ai-chat-title,
.ai-chat-row .ai-chat-title {
  color: var(--ink) !important;
  font-weight: 400 !important;
}

.ai-chat-main {
  flex: 1; /* 横幅を兄弟要素（ピン留め・メニューボタン）を除いた全領域に追従 */
  min-width: 0; /* flexコンテナ下でのテキストの押し広げを防止 */
  border: 0;
  background: transparent;
  padding: 0;
  color: #334155;
  text-align: left;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-chat-title,
.ai-chat-time {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-chat-title {
  flex: 1;
  min-width: 0;
}

.ai-chat-time {
  flex-shrink: 0;
  margin-top: 0;
  display: inline-block;
}

.ai-chat-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
}

.ai-chat-time {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.ai-chat-pin,
.ai-project-pin,
.ai-chat-menu-btn {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ai-chat-pin.active,
.ai-project-pin.active,
.ai-chat-pin:hover,
.ai-project-pin:hover,
.ai-chat-menu-btn:hover {
  color: var(--ink);
  background: #e5e7eb;
}

.ai-chat-pin.active,
.ai-project-pin.active {
  color: var(--ink);
  background: transparent;
}

.ai-chat-menu-btn::before {
  content: "";
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

.ai-chat-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 50;
  min-width: 146px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  grid-column: 1 !important;
  grid-row: 1 !important;
  pointer-events: auto;
}

.ai-chat-menu.open {
  display: grid;
}

.ai-chat-menu button {
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 0 8px;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
}

.ai-chat-menu button:hover {
  background: #f1f5f9;
}

.ai-project-group {
  display: grid;
  gap: 2px;
  align-content: start;
}

.ai-project-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border-radius: 8px;
  padding: 4px 4px;
  color: var(--ink) !important;
  cursor: pointer;
  background: transparent;
  min-width: 0; /* 親Gridの自動幅伸縮バグを防ぎ、...省略表示を100%有効化 */
  transition: background-color 0.15s ease;
}

.ai-project-row:hover {
  background: #f8fafc;
}

.ai-project-row.active {
  background: #f1f5f9;
}

.ai-project-row.active .ai-project-title,
.ai-project-row.active .ai-project-icon,
.ai-project-row .ai-project-title,
.ai-project-row .ai-project-icon {
  color: var(--ink) !important;
  font-weight: 400 !important;
}

.ai-project-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
}

.ai-project-title {
  border: 0;
  background: transparent;
  min-width: 0;
  overflow: hidden;
  color: #4b5563;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.ai-project-toggle-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ai-project-toggle-btn:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.ai-history-section-row {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 0 32px 0 4px;
}

.ai-history-section-title {
  flex: 1;
  min-width: 0;
  margin: 0 !important;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}


.ai-project-empty {
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}

.ai-project-empty:hover {
  background: #f3f4f6;
  color: var(--ink);
}

.ai-history-empty {
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.5;
}

.ai-attach-btn,
.ai-voice-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.ai-attach-btn input {
  display: none;
}

.ai-attach-btn:hover,
.ai-voice-btn:hover:not(:disabled) {
  border-color: #94a3b8;
  color: #0f172a;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}

.ai-attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

.ai-chat-image-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}



.ai-attachment-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #ffffff;
}

.ai-attachment-thumb img,
.ai-chat-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ai-chat-image {
  width: 78px;
  height: 78px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.ai-chat-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ai-chat-attachment {
  max-width: 220px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-message-accordion {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.ai-message-accordion-content {
  position: relative;
  max-height: calc(1.65em * 5);
  overflow: hidden;
  transition: max-height 0.24s ease;
}

.ai-message-accordion-content::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3.5em;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(248, 250, 252, 0), var(--ai-message-fade-bg, #f8fafc) 82%);
  transition: opacity 0.18s ease;
}

.ai-message-accordion.expanded .ai-message-accordion-content {
  max-height: none;
}

.ai-message-accordion.expanded .ai-message-accordion-content::after {
  opacity: 0;
}

.ai-message-accordion-toggle {
  margin-top: 2px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  padding: 0;
  cursor: pointer;
}

.ai-message-accordion-toggle:hover {
  background: #eef2f7;
  color: var(--ink);
}

.ai-message-accordion-toggle svg {
  transition: transform 0.18s ease;
}

.ai-message-accordion.expanded .ai-message-accordion-toggle svg {
  transform: rotate(180deg);
}

.ai-message-actions {
  position: absolute;
  bottom: -30px;
  display: flex;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 5;
}

/* 透明なブリッジを広げ、-30pxの間隔でもホバーが切れないようにする */
.ai-message-actions::before {
  content: "";
  position: absolute;
  top: -16px;
  left: -8px;
  right: -8px;
  height: 22px;
  background: transparent;
  pointer-events: auto;
}

.chat-bubble:hover .ai-message-actions,
.ai-message-actions:hover,
.ai-message-actions:focus-within {
  opacity: 1;
  pointer-events: auto;
}

.chat-message-stack {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.chat-message-stack.assistant {
  align-items: flex-start;
}

.ai-message-actions.user {
  right: 8px;
}

.ai-message-actions.assistant {
  left: 0;
}

.ai-message-action-btn {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ai-message-action-btn:hover {
  background: #eef2f7;
  color: #0f172a;
}

.ai-attachment-thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  padding: 0;
}

.ai-attachment-thumb button::before,
.ai-attachment-thumb button::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 4px;
  width: 8px;
  height: 1.5px;
  background: #ffffff;
}

.ai-attachment-thumb button::before {
  transform: rotate(45deg);
}

.ai-attachment-thumb button::after {
  transform: rotate(-45deg);
}

/* AIチャット入力欄と送信ボタンのプレミアムなフォーカス・ホバーエフェクト */
#aiChatInput {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#aiChatInput:focus {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

#aiSendBtn {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#aiSendBtn:hover {
  background-color: #1e293b !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15) !important;
}

#aiSendBtn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.ai-voice-btn:active:not(:disabled) {
  transform: translateY(0);
}

.ai-voice-btn:disabled {
  cursor: not-allowed;
  color: #94a3b8;
  background: #f8fafc;
}

.ai-voice-btn.is-listening {
  border-color: #64748b;
  color: #0f172a;
  background: #f1f5f9;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.16);
}

.ai-voice-icon {
  display: block;
}

/* リアルタイム緑丸インジケーターのスタイル（静的でスッキリとした緑丸） */
.status-dot {
  display: inline-block;
  width: 7.5px;
  height: 7.5px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  margin-right: 4px;
}

/* ログアウトボタンを最初から最も濃いダークグレー背景＆白文字に固定 */
.topbar-right button[data-action="logout"] {
  background: #1e293b !important; /* slate-800 の濃いグレーに固定 */
  color: #ffffff !important;
  border-color: #1e293b !important;
}

/* ==========================================================================
   Responsive admin workspace
   ========================================================================== */

@media (max-width: 1180px) {
  body {
    min-width: 0;
    overflow-x: hidden;
  }

  .topbar {
    margin-left: 0;
    width: 100%;
  }

  .workspace,
  .workspace.collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  .main-pane,
  .workspace.collapsed .main-pane {
    grid-column: 1;
  }
}

@media (max-width: 900px) {
  html,
  body {
    width: 100%;
  }

  .app-shell {
    min-height: 100svh;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .topbar,
  .topbar.collapsed {
    position: sticky;
    top: 0;
    height: auto;
    min-height: 56px;
    padding: 8px 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .topbar-left,
  .topbar-right {
    min-width: 0;
    width: 100%;
  }

  .topbar-left {
    overflow: hidden;
  }

  .active-project-indicator {
    margin-left: 0 !important;
    max-width: 100%;
    flex-wrap: wrap;
    line-height: 1.4;
  }

  .topbar-right {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .mode-tabs {
    flex: 1 1 160px;
  }

  .mode-tabs button {
    flex: 1;
  }

  .topbar-right button[data-action="new-project"],
  .topbar-right button[data-action="logout"] {
    min-width: 0;
    flex: 1 1 132px;
  }

  .workspace,
  .workspace.collapsed {
    display: block;
    min-height: auto;
  }

  .sidebar {
    position: relative;
    top: auto;
    width: 100%;
    height: auto;
    max-height: none;
    z-index: 25;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
  }

  .sidebar.collapsed {
    display: none;
  }

  .sidebar-header {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    flex-direction: row;
    gap: 6px;
    padding: 8px 10px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar-nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 36px;
    padding: 0 12px;
    white-space: nowrap;
    border: 1px solid transparent;
    background: #ffffff;
  }

  .sidebar-nav-item.active {
    border-color: var(--line-strong);
  }

  .sidebar-footer,
  .sidebar-edge-toggle {
    display: none;
  }

  .main-pane {
    padding: 14px;
    overflow: visible;
  }

  .workspace-content {
    min-width: 0;
  }

  .panel {
    margin-bottom: 14px;
    border-radius: 10px;
  }

  .panel-head {
    height: auto;
    min-height: 50px;
    padding: 12px 14px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .panel-head h2 {
    line-height: 1.4;
  }

  .panel-body,
  .settings-stack {
    padding: 14px;
  }

  .grid-2,
  .form-design-grid,
  .email-grid,
  .reminder-options,
  .metric-grid,
  .history-grid,
  .modal-body,
  .ai-filter-bar,
  .html-editor-wrap {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .field[style*="grid-column"],
  .settings-help[style*="grid-column"],
  .check-row[style*="grid-column"],
  .grid-2[style*="grid-column"] {
    grid-column: 1 / -1 !important;
  }

  .field-palette {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .selected-field {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .selected-field-actions,
  .email-card-head,
  .email-card-actions,
  .block-title {
    flex-wrap: wrap;
  }

  .canvas-stack {
    max-width: 100%;
    margin-bottom: 20px;
  }

  .canvas-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .link-pop {
    min-width: min(270px, calc(100vw - 48px));
  }

  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal {
    width: 100%;
    height: 94svh;
    border-radius: 16px;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .modal-head,
  .modal-foot {
    padding: 12px 14px;
    flex-wrap: wrap;
  }

  .code-editor {
    min-height: 420px;
    padding: 16px;
    font-size: 12px;
  }
}

@media (max-width: 640px) {
  .main-pane {
    padding: 10px;
  }

  .panel-body,
  .settings-stack {
    padding: 12px;
  }

  .btn {
    min-height: 30px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 10.5px;
    gap: 5px;
  }

  .btn.small {
    min-height: 26px;
    padding: 0 7px;
    font-size: 10px;
  }

  .panel-head > div,
  .email-card-actions {
    width: 100%;
  }

  .panel-head .btn,
  .email-card-actions .btn {
    flex: 1 1 auto;
  }

  .topbar-right {
    gap: 6px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }

  .mode-tabs {
    min-width: 0;
    flex: none;
  }

  .mode-tabs button,
  .sub-tabs button {
    height: 30px;
    padding: 0 8px;
    font-size: 11px;
  }

  .topbar-right button[data-action="new-project"],
  .topbar-right button[data-action="logout"] {
    min-width: 0;
    width: auto;
    flex: none;
    white-space: nowrap;
  }

  .active-project-indicator {
    font-size: 11px !important;
    gap: 6px !important;
  }

  .active-project-indicator .btn {
    min-height: 28px;
    padding: 0 8px;
    font-size: 10px;
  }

  .sidebar-nav {
    gap: 4px;
    padding: 6px 8px;
  }

  .sidebar-nav-item {
    min-height: 32px;
    padding: 0 9px;
    gap: 6px;
    font-size: 11.5px;
    border-radius: 7px;
  }

  .sidebar-icon {
    width: 14px;
    height: 14px;
  }
}

/* ==========================================================================
   CODEX風リッチ検索モーダル（コマンドパレット）および検索ラッパー
   ========================================================================== */

/* サイドバー検索窓アイコンラッパー */
.ai-search-wrapper {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  width: 100%;
  height: 34px;
  margin-bottom: 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: all 0.18s ease-in-out;
  box-sizing: border-box;
}

.ai-search-wrapper:hover {
  background: #f3f4f6;
}

.ai-search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  grid-column: 1;
  width: 22px;
}

.ai-search-wrapper .ai-chat-search {
  margin-bottom: 0 !important;
  padding-left: 0 !important;
  padding-right: 12px !important;
  cursor: pointer;
  pointer-events: none;
  grid-column: 2;
  font-size: 13px !important;
  color: var(--ink) !important;
  font-weight: 400 !important;
  font-family: inherit !important;
  border: 0;
  background: transparent;
}

.ai-search-wrapper .ai-chat-search::placeholder {
  color: var(--ink) !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  opacity: 1 !important;
  font-family: inherit !important;
}

/* 検索モーダルのバックドロップ（背景ぼかし） */
.ai-search-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  padding-top: 12vh;
  animation: aiSearchFadeIn 0.15s ease-out forwards;
}

/* 検索モーダルフロートウィンドウ */
.ai-search-modal {
  width: 100%;
  max-width: 540px;
  height: fit-content;
  max-height: 420px;
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: aiSearchSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* モーダルヘッダー */
.ai-search-modal-header {
  display: flex;
  align-items: center;
  height: 52px;
  border-bottom: 1.5px solid var(--line);
  padding: 0 16px;
  gap: 10px;
}

.ai-search-modal-icon {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
}

.ai-modal-search-input {
  flex: 1;
  border: 0;
  outline: none;
  font-size: 13.5px;
  color: var(--ink);
  background: transparent;
  height: 100%;
}

/* モーダル閉じるボタン */
.ai-search-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s ease-in-out;
  padding: 0;
}

.ai-search-modal-close:hover {
  color: var(--ink);
  background: #f1f5f9;
}

/* モーダルボディ */
.ai-search-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  min-height: 100px;
  background: #ffffff;
}

/* セクションタイトル */
.ai-search-section-title {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 12px 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: Inter, sans-serif;
}

/* 検索結果行 */
.ai-search-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: all 0.12s ease-in-out;
  border: 0;
  background: transparent;
  width: 100%;
  box-sizing: border-box;
}

.ai-search-result-row:hover,
.ai-search-result-row.active {
  background: #f1f5f9;
}

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

.ai-search-result-dot {
  color: var(--accent);
  font-size: 7px;
  display: inline-block;
  line-height: 1;
}

.ai-search-result-title {
  font-size: 12.5px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}

.ai-search-result-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* プロジェクトバッジ */
.ai-search-project-badge {
  font-size: 9.5px;
  color: #475569;
  background: #e2e8f0;
  border-radius: 4.5px;
  padding: 1.5px 5.5px;
  font-weight: 500;
  font-family: Inter, sans-serif;
}

/* ショートカットバッジ */
.ai-search-shortcut-badge {
  font-size: 9.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4.5px;
  font-family: Inter, sans-serif;
  letter-spacing: 0.05em;
}

/* 検索結果が空のとき */
.ai-search-empty {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 28px 0;
  font-family: Inter, sans-serif;
}

/* アニメーションキーフレーム */
@keyframes aiSearchFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes aiSearchSlideDown {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   AI Analyst Sidebar Styles - スリム＆フラット統一
   ========================================================================== */

/* フォルダ新規作成ボタンのホバースタイル */
.ai-folder-create-btn {
  background: transparent;
  border: none;
  padding: 4px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.ai-folder-create-btn:hover {
  background: #f1f5f9;
  color: var(--ink);
}

/* 「＋」ボタン（チャット開始）の絶対配置 */
.ai-project-add-chat-btn {
  position: absolute !important;
  right: 58px; /* メニューと開閉トグルの左側に配置 */
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, background-color 0.15s ease, color 0.15s ease;
  z-index: 2;
}

.ai-project-add-chat-btn svg {
  display: block;
}

.ai-project-add-chat-btn:hover {
  background: #e2e8f0;
  color: var(--ink);
}

/* アクションボタンコンテナの絶対配置（重なりを防ぐ） */
.ai-chat-actions,
.ai-project-actions {
  position: absolute !important;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  background: linear-gradient(90deg, rgba(248, 250, 252, 0), #f8fafc 16px, #f8fafc 100%);
  border-radius: 8px;
  padding-left: 18px;
}

.ai-chat-actions {
  right: 4px;
}

.ai-project-actions {
  right: 32px; /* 開閉トグルボタンの左側 */
}

.ai-chat-row.active .ai-chat-actions,
.ai-project-row.active .ai-project-actions {
  background: linear-gradient(90deg, rgba(241, 245, 249, 0), #f1f5f9 16px, #f1f5f9 100%);
}

/* ホバー時にアクションコンテナをふわっと表示（アクティブ時であってもホバーしていない時は非表示に） */
.ai-chat-row:hover .ai-chat-actions,
.ai-project-row:hover .ai-project-actions {
  opacity: 1;
  pointer-events: auto;
}

/* コンテナ内のボタン位置や不透明度の初期化 */
.ai-chat-actions .ai-chat-pin,
.ai-chat-actions .ai-chat-menu-btn,
.ai-project-actions .ai-project-add-chat-btn,
.ai-project-actions .ai-project-pin,
.ai-project-actions .ai-chat-menu-btn {
  position: static !important;
  transform: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

/* テキスト領域が右側のアクションコンテナと被るのを防ぐ設定 */
.ai-project-title {
  flex: 1;
  min-width: 0;
  padding-right: 48px; /* 開閉トグル＋アクション群との重なりを許容しギリギリまで広げる */
  box-sizing: border-box;
}


/* フォルダ直下チャットリスト of インデントとガイド線 */
.ai-project-chats {
  padding-left: 20px !important;
  border-left: none;
  display: grid;
  gap: 2px;
  box-sizing: border-box;
}

.ai-project-chats[hidden] {
  display: none !important;
}

/* プロンプトモーダル内の入力欄フォーカス */
.custom-modal-prompt-input:focus {
  border-color: #94a3b8 !important;
  box-shadow: none !important;
}

/* ピン留めリストの高さ制限とスクロールバー発生を防止 */
.ai-pinned-list {
  max-height: none !important;
  overflow: visible !important;
}

/* ピン留めセクション内での排他ホバー表示（ピン留めリストの中では、ホバー時のみアクションコンテナをふわっと表示する） */
.ai-pinned-list .ai-chat-actions,
.ai-pinned-list .ai-project-actions {
  opacity: 0;
  pointer-events: none;
}

.ai-pinned-list .ai-chat-row:hover .ai-chat-actions,
.ai-pinned-list .ai-project-row:hover .ai-project-actions {
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   Responsive AI analyst
   ========================================================================== */

@media (max-width: 900px) {
  .ai-analyst-shell {
    min-height: auto !important;
    padding-bottom: 0 !important;
  }

  .ai-mobile-view-switch {
    position: sticky;
    top: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin: 0 0 12px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f1f5f9;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  }

  .ai-mobile-view-switch button {
    height: 36px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
  }

  .ai-mobile-view-switch button.active {
    background: #ffffff;
    color: var(--ink);
    box-shadow: 0 1px 6px rgba(20, 26, 35, 0.08);
  }

  .ai-analyst-container {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
    min-height: auto !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }

  .ai-history-pane {
    height: auto !important;
    max-height: 44svh !important;
    min-height: 0 !important;
    padding: 12px !important;
    overflow: hidden !important;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: var(--shadow);
  }

  .ai-sidebar-scroll-area {
    max-height: calc(44svh - 112px);
    overflow-y: auto;
    padding-right: 2px;
  }

  .ai-sidebar-actions {
    margin-bottom: 8px;
  }

  .ai-search-wrapper {
    padding: 0;
  }

  .ai-chat-search {
    margin-bottom: 8px;
  }

  .ai-sidebar-edge-toggle {
    display: none !important;
  }

  .chat-pane,
  .ai-analyst-chat-pane {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 360px !important;
    max-height: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .ai-analyst-container > .chat-pane:first-child {
    min-height: calc(100svh - 190px) !important;
  }

  .ai-analyst-shell.mobile-view-chat .artifact-pane {
    display: none !important;
  }

  .ai-analyst-shell.mobile-view-artifact .ai-analyst-chat-pane {
    display: none !important;
  }

  .chat-thread-container {
    max-height: 54svh !important;
    min-height: 260px;
    overflow-y: auto !important;
    padding: 0 !important;
    margin-bottom: 12px !important;
    -webkit-overflow-scrolling: touch;
  }

  .chat-message-row {
    margin-bottom: 14px !important;
  }

  .chat-message-stack {
    max-width: 100% !important;
  }

  .chat-bubble {
    font-size: 13px !important;
    overflow-wrap: anywhere;
  }

  .ai-chat-box-wrapper {
    position: sticky !important;
    bottom: 8px;
    z-index: 5;
    border-radius: 16px !important;
  }

  #aiChatInput {
    font-size: 16px !important;
  }

  .chat-suggestions {
    margin-top: 18px !important;
    justify-content: flex-start !important;
  }

  .chat-suggestions .btn {
    width: 100%;
    text-align: left !important;
    justify-content: flex-start;
  }

  .artifact-pane {
    width: 100% !important;
    height: auto !important;
    min-height: 320px !important;
    max-height: 68svh !important;
    overflow: hidden !important;
    border-radius: 12px !important;
  }

  .artifact-header {
    height: auto !important;
    min-height: 52px;
    padding: 12px 14px !important;
    flex-wrap: wrap;
    gap: 10px;
  }

  .artifact-header > div {
    min-width: 0;
    flex-wrap: wrap;
  }

  .artifact-header .btn {
    flex: 1 1 150px;
  }

  .artifact-body {
    max-height: calc(68svh - 56px);
    padding: 16px !important;
    overflow: auto !important;
    overflow-wrap: anywhere;
    -webkit-overflow-scrolling: touch;
  }

  .artifact-body table {
    min-width: 560px;
  }

  .chart-wrapper {
    min-width: 0;
    overflow-x: auto;
  }

  .ab-decision-row {
    flex-direction: column;
  }

  .ai-attachment-preview {
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  .ai-chat-image-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  }

  .ai-search-modal {
    width: min(94vw, 680px) !important;
    max-height: 82svh !important;
  }
}

@media (max-width: 640px) {
  .ai-history-pane {
    max-height: 38svh !important;
    padding: 10px !important;
  }

  .ai-mobile-view-switch {
    margin-bottom: 8px;
    padding: 3px;
    border-radius: 8px;
  }

  .ai-mobile-view-switch button {
    height: 30px;
    border-radius: 6px;
    font-size: 11px;
  }

  .ai-sidebar-scroll-area {
    max-height: calc(38svh - 106px);
  }

  .chat-thread-container {
    max-height: 50svh !important;
  }

  .artifact-pane {
    max-height: 64svh !important;
  }

  .artifact-body {
    max-height: calc(64svh - 56px);
    padding: 14px !important;
  }

  .ai-analyst-shell h1 {
    font-size: 22px !important;
    margin-bottom: 20px !important;
  }

  .ai-filter-bar {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .ai-project-row,
  .ai-chat-row {
    min-height: 38px;
  }

  .ai-project-actions,
  .ai-chat-actions,
  .ai-pinned-list .ai-project-actions,
  .ai-pinned-list .ai-chat-actions {
    opacity: 1;
    pointer-events: auto;
  }

  .ai-project-title {
    padding-right: 68px;
  }
}
/* ==========================================================================
   ShunLP AI Analytics Layout & Styling
   ========================================================================== */

.main-pane:has(.ai-analyst-shell) {
  overflow: hidden !important;
  padding: 20px !important;
  box-sizing: border-box !important;
  height: calc(100vh - 56px) !important;
}

.main-pane:has(.ai-analyst-shell) .workspace-content {
  height: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.ai-analyst-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}

.ai-analyst-container {
  display: grid;
  gap: 20px;
  box-sizing: border-box;
  align-items: stretch;
  grid-template-columns: var(--container-cols, minmax(0, 1fr));
  height: 100%;
  flex: 1;
  min-height: 0;
}

.chat-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.chat-pane.initial-state {
  justify-content: center;
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 24px 0;
  height: 100%;
  max-width: 680px;
  margin: 0 auto;
}

.chat-pane.normal-state {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  height: 100%;
}

.chat-thread-container {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}

.ai-initial-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 16px 0;
  text-align: center;
  font-family: Inter, -apple-system, sans-serif;
  letter-spacing: -0.02em;
}

.ai-premium-dashboard-wrapper {
  width: 100%;
  max-width: 680px;
  margin-bottom: 24px;
  box-sizing: border-box;
}

/* --- チャット入力エリア --- */

.ai-chat-box-wrapper {
  width: 100%;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.06);
  padding: 8px 10px;
  box-sizing: border-box;
  transition: all 0.2s ease-in-out;
}

.ai-chat-box-wrapper.compact {
  margin-bottom: 8px;
}

.ai-attach-btn {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.ai-voice-btn {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.ai-slash-toggle-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  font-family: Inter, sans-serif;
}

.ai-chat-input-textarea {
  flex: 1;
  min-width: 0;
  height: 30px;
  min-height: 30px;
  max-height: 160px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  line-height: 1.45;
  resize: none;
  color: var(--ink);
  font-family: inherit;
  box-sizing: border-box;
  padding: 5px 4px;
  margin: 0;
  overflow-y: hidden;
}

.ai-chat-input-textarea.normal-view {
  font-size: 13.5px;
}

.ai-send-btn {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  border: none;
  background: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  min-height: 30px;
  transition: background-color 0.15s;
}

/* --- サジェスト質問（予測質問） --- */

.chat-suggestions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 32px;
  width: 100%;
}

.ai-suggest-btn {
  background: #ffffff;
  color: #475569;
  font-weight: 400;
  border-radius: 24px;
  border: 1px solid var(--line-strong);
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 11.5px;
  line-height: 1.4;
  box-sizing: border-box;
}

.ai-suggest-btn.initial-state {
  text-align: center;
  display: inline-block;
  max-width: 100%;
}

.ai-suggest-btn.normal-state {
  text-align: left;
  display: block;
  width: 100%;
}

/* --- チャットスレッド・吹き出し --- */

.chat-message-row {
  display: flex;
  margin-bottom: 20px;
  width: 100%;
}

.chat-message-row.assistant {
  justify-content: flex-start;
}

.chat-message-row.user {
  justify-content: flex-end;
}

.chat-message-stack {
  width: 100%;
}

.chat-message-stack.assistant {
  max-width: 100%;
}

.chat-message-stack.user {
  max-width: 70%;
  margin-left: auto;
}

.chat-bubble {
  position: relative;
  width: 100%;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink);
  box-shadow: none;
  box-sizing: border-box;
}

.chat-bubble.assistant {
  padding: 8px 0;
  border-radius: 0;
  background: transparent;
  --ai-message-fade-bg: #f8fafc;
  border: none;
}

.chat-bubble.user {
  padding: 10px 16px;
  border-radius: 18px;
  background: #f3f4f6;
  --ai-message-fade-bg: #f3f4f6;
  border: 1px solid #e5e7eb;
  width: fit-content;
  margin-left: auto;
  text-align: left;
}

/* --- ローディング＆インジケータ --- */

.ai-chat-loading-indicator {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  width: fit-content;
  margin-bottom: 20px;
}

.ai-chat-loading-indicator span {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.ai-voice-input-notice {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.5;
  color: #64748b;
}

/* --- ヒートマップ & アーティファクトセクション --- */

.ai-artifact-section-header {
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-artifact-section-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  font-family: Inter, sans-serif;
}

.ai-heatmap-wrapper {
  background: rgba(0, 0, 0, 0.005);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

/* --- アーティファクト領域 --- */

.artifact-pane {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  box-sizing: border-box;
  height: 100%;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.artifact-header {
  height: 52px;
  border-bottom: 1.5px solid var(--line);
  background: #f8fafc;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
}

.artifact-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.artifact-header-title span {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: Inter, sans-serif;
}

.artifact-header-actions {
  display: flex;
  gap: 8px;
}

.artifact-header-actions .btn {
  border-radius: 6px;
  font-weight: 400;
}

.artifact-header-actions .btn.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.artifact-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  box-sizing: border-box;
  font-size: 13px;
  line-height: 1.65;
  color: #334155;
  font-family: Inter, sans-serif;
}

.ab-decision-row {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.ab-decision-row .btn {
  flex: 1;
  height: 32px;
  font-weight: 500;
  font-size: 12px;
  border-radius: 6px;
  text-align: center;
  justify-content: center;
  display: inline-flex;
  align-items: center;
}

.ab-decision-row .btn.secondary {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
}

/* Custom Multi-select Dropdown styling */
.ai-filter-bar .field {
  position: relative;
}

.ai-multiselect-dropdown {
  position: relative;
  width: 100%;
}

.ai-multiselect-trigger {
  width: 100%;
  min-height: 32px;
  padding: 6px 30px 6px 12px;
  background: #ffffff;
  border: 1px solid var(--line-strong, #e2e8f0);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink, #0f172a);
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-multiselect-trigger:hover {
  border-color: #cbd5e1;
}

.ai-multiselect-trigger::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid #64748b;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.ai-multiselect-dropdown.open .ai-multiselect-trigger::after {
  transform: translateY(-50%) rotate(180deg);
}

.ai-multiselect-panel {
  display: none;
  position: absolute;
  top: 105%;
  left: 0;
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--line-strong, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  box-sizing: border-box;
  padding: 6px 0;
}

.ai-multiselect-dropdown.open .ai-multiselect-panel {
  display: block;
}

.ai-multiselect-option {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
  box-sizing: border-box;
  gap: 8px;
}

.ai-multiselect-option:hover {
  background: #f1f5f9;
}

.ai-multiselect-option input[type="checkbox"] {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  accent-color: var(--primary, #b3495b);
  cursor: pointer;
}

.ai-multiselect-option-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.ai-multiselect-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 4px 0;
}

/* AI Chat Navigator Styling */
.ai-chat-navigator-container {
  position: relative;
  width: 100%;
  height: 40px; /* ホバー検知用に高さを確保 */
  margin-top: -40px; /* 入力欄の真上に被せるためのネガティブマージン */
  display: flex;
  justify-content: center;
  z-index: 100;
}

.ai-chat-navigator {
  position: absolute;
  bottom: 8px; /* 入力欄の少し上に浮かせる */
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--line-strong, #e2e8f0);
  border-radius: 20px;
  padding: 4px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
  
  /* デフォルト非表示、クラス付与でふわっと表示 */
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chat-navigator.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.ai-nav-btn {
  background: transparent;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.ai-nav-btn:hover {
  background: #f1f5f9;
  color: var(--primary, #b3495b);
}

.ai-nav-btn svg {
  width: 14px;
  height: 14px;
}

.ai-nav-indicator {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  padding: 0 6px;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ai-nav-current-input {
  width: 28px !important;
  height: 20px !important;
  line-height: 20px !important;
  border: 1px solid var(--line-strong, #e2e8f0) !important;
  background: #f8fafc !important;
  border-radius: 4px !important;
  padding: 0 4px !important;
  margin: 0 !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  color: var(--ink, #0f172a) !important;
  text-align: center !important;
  outline: none !important;
  box-shadow: none !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.ai-nav-current-input:focus {
  border-color: #94a3b8 !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.1) !important;
}

.ai-nav-current-input::-webkit-outer-spin-button,
.ai-nav-current-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ai-nav-total {
  font-size: 11px;
  color: #64748b;
  user-select: none;
  padding-left: 2px;
}
