/* ============================================
   NECTO Design System — CSS Custom Properties
   ============================================
   新規UIはこれらの変数を使用すること。
   既存のハードコード値は段階的に移行予定。
   仕様書: docs/design-system/necto.md
   ============================================ */
:root {
  /* --- Colors: Primary (Blue) --- */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-active: #1e40af;
  --color-primary-light: #3b82f6;
  --color-primary-subtle: #dbeafe;
  --color-primary-bg: #eff6ff;

  /* --- Colors: Danger / Error (Red) --- */
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-danger-subtle: #fee2e2;
  --color-danger-bg: #fef2f2;
  --color-danger-text: #dc2626;

  /* --- Colors: Success (Green) --- */
  --color-success: #22c55e;
  --color-success-hover: #16a34a;
  --color-success-dark: #059669;
  --color-success-subtle: #d1fae5;
  --color-success-bg: #f0fdf4;
  --color-success-text: #065f46;

  /* --- Colors: Warning (Amber) --- */
  --color-warning: #f59e0b;
  --color-warning-subtle: #fef3c7;
  --color-warning-bg: #fffbeb;
  --color-warning-text: #92400e;

  /* --- Colors: Info (Cyan) --- */
  --color-info: #0284c7;
  --color-info-subtle: #e0f2fe;
  --color-info-bg: #f0f9ff;
  --color-info-border: #bae6fd;

  /* --- Text Colors --- */
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-tertiary: #6b7280;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;

  /* --- Background Colors --- */
  --bg-body: #f5f5f5;
  --bg-surface: #ffffff;
  --bg-muted: #f9fafb;
  --bg-subtle: #f3f4f6;
  --bg-hover: #f3f4f6;
  --bg-active: #e5e7eb;
  --bg-nav: #111827;
  --bg-input: #f8fafc;

  /* --- Border Colors --- */
  --border-default: #e5e7eb;
  --border-light: #f1f5f9;
  --border-medium: #d1d5db;
  --border-input: #d1d5db;
  --border-focus: #2563eb;

  /* --- Typography --- */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', sans-serif;
  --font-size-xs: 10px;
  --font-size-sm: 11px;
  --font-size-base: 12px;
  --font-size-md: 13px;
  --font-size-lg: 14px;
  --font-size-xl: 16px;
  --font-size-2xl: 18px;
  --font-size-3xl: 20px;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.3;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.6;

  /* --- Spacing (4px base) --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* --- Border Radius --- */
  --radius-sm: 3px;
  --radius-md: 5px;
  --radius-lg: 6px;
  --radius-xl: 8px;
  --radius-full: 9999px;

  /* --- Shadows --- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.15);
  --shadow-focus: 0 0 0 2px rgba(37, 99, 235, 0.2);

  /* --- Transitions --- */
  --transition-fast: 0.1s ease;
  --transition-normal: 0.15s ease;
  --transition-slow: 0.25s ease;

  /* --- Z-Index Scale --- */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-column-menu: 500;
  --z-tooltip: 600;
  --z-modal-backdrop: 900;
  --z-modal: 1000;
  --z-overlay: 1100;
  --z-toast: 1200;

  /* --- Layout --- */
  --sidebar-width: 180px;
  --sidebar-collapsed: 36px;
  --topnav-height: 40px;
  --toolbar-height: 36px;
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-body);
  height: 100vh;
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
}

/* === アナウンスバー === */
.announcement-bar {
  display: none;
  align-items: center;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
  position: relative;
  min-height: 32px;
  overflow: hidden;
  transition: background 0.3s, color 0.3s;
}
.announcement-bar-content {
  flex: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.3s;
}
.ann-icon {
  margin-right: 6px;
  flex-shrink: 0;
}
.ann-text {
  display: inline-block;
  white-space: nowrap;
}
.ann-text.ann-scroll {
  animation: ann-scroll-anim var(--ann-scroll-duration, 10s) linear infinite;
}
.announcement-bar-content:hover .ann-text.ann-scroll {
  animation-play-state: paused;
}
@keyframes ann-scroll-anim {
  0% { transform: translateX(0); }
  10% { transform: translateX(0); }
  90% { transform: translateX(calc(-100% + 200px)); }
  100% { transform: translateX(calc(-100% + 200px)); }
}
.announcement-bar-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 10px;
  flex-shrink: 0;
}
.ann-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.3;
}
.ann-dot.active {
  opacity: 0.8;
}
.announcement-bar-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0 4px;
  flex-shrink: 0;
  line-height: 1;
}
.announcement-bar-close:hover {
  opacity: 1;
}

/* アナウンス管理カード */
.announcement-form-card {
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
}

/* === トップナビバー（BOSS風ダークデザイン） === */
.mode-bar {
  display: flex;
  align-items: stretch;
  background: #1f2937;
  flex-shrink: 0;
  height: 42px;
}
.mode-bar-logo {
  display: flex;
  align-items: center;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.mode-btn {
  padding: 0 18px;
  border: none;
  background: transparent;
  font-size: 13px;
  cursor: pointer;
  color: #d1d5db;
  transition: all 0.15s;
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
}
.mode-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}
.mode-btn.active {
  color: #1f2937;
  background: #fff;
  font-weight: 600;
  border-bottom-color: #dc2626;
  border-radius: 0;
}

/* === レイアウト: ナビ下の横分割 === */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* === 左サイドバー === */
.app-sidebar {
  width: 180px;
  background: #f9fafb;
  border-right: 1px solid #e5e7eb;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  transition: width 0.2s ease;
  position: relative;
}
.app-sidebar.collapsed {
  width: 36px;
}
.sidebar-toggle-btn {
  position: absolute;
  top: 6px;
  right: 2px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: #b0b7c3;
  cursor: pointer;
  font-size: 12px;
  z-index: 2;
  border-radius: 3px;
  transition: color 0.1s, background 0.1s;
  opacity: 0;
}
.app-sidebar:hover .sidebar-toggle-btn,
.app-sidebar.collapsed .sidebar-toggle-btn { opacity: 1; }
.sidebar-toggle-btn:hover { color: #374151; background: #e5e7eb; }
.app-sidebar.collapsed .sidebar-toggle-btn {
  position: static;
  width: 100%;
  height: 32px;
  border-radius: 0;
  opacity: 1;
  font-size: 14px;
  color: #9ca3af;
}
.app-sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.app-sidebar.collapsed .app-sidebar-nav { display: none; }
.app-sidebar.collapsed .sidebar-user { display: none !important; }
.sidebar-item {
  display: block;
  width: 100%;
  padding: 7px 16px;
  border: none;
  background: none;
  text-align: left;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}
.sidebar-item:hover { background: #e5e7eb; }
.sidebar-item.active {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}
.sidebar-group-label {
  display: block;
  width: 100%;
  padding: 6px 16px 3px;
  border: none;
  background: none;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.sidebar-group-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.sidebar-group-toggle:hover {
  background: #eef2f7;
  color: #6b7280;
}
.sidebar-group-toggle.open {
  color: #6b7280;
}
.sidebar-group-chevron {
  width: 10px;
  flex: 0 0 10px;
  font-size: 9px;
  color: #9ca3af;
}
.sidebar-group-text {
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-group-children {
  overflow: hidden;
}
.sidebar-child {
  padding-left: 28px;
  font-size: 11.5px;
}
/* --- サイドバー並べ替えモード --- */
.sidebar-reorder-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #fef3c7;
  border-bottom: 1px solid #fcd34d;
  font-size: 11px;
  color: #92400e;
  font-weight: 600;
}
.sidebar-reorder-bar button {
  padding: 3px 10px;
  font-size: 11px;
  background: #1d4ed8;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.sidebar-reorder-bar button:hover { background: #1e40af; }
.sidebar-reorder-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  margin: 4px 8px;
  font-size: 11px;
  color: #6b7280;
  background: none;
  border: 1px dashed #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  width: calc(100% - 16px);
  justify-content: center;
}
.sidebar-reorder-btn:hover { background: #f3f4f6; color: #374151; border-color: #9ca3af; }
.sidebar-nav-reordering .sidebar-item { cursor: default; }
.sidebar-nav-reordering .sidebar-item:hover { background: none; }
.sidebar-nav-reordering .sidebar-item.active { background: #dbeafe; }
.sidebar-drag-handle {
  display: inline-flex;
  align-items: center;
  cursor: grab;
  color: #9ca3af;
  margin-right: 4px;
  font-size: 12px;
  user-select: none;
  flex-shrink: 0;
}
.sidebar-drag-handle:hover { color: #374151; }
.sidebar-drag-handle:active { cursor: grabbing; }
.sidebar-drag-wrapper {
  display: flex;
  align-items: center;
}
.sidebar-drag-wrapper.dragging { opacity: 0.4; }
.sidebar-drop-indicator {
  height: 2px;
  background: #3b82f6;
  margin: 0 8px;
  border-radius: 1px;
  transition: opacity 0.1s;
}
.sidebar-user {
  padding: 10px 14px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #6b7280;
}
.sidebar-user-name { font-weight: 600; color: #374151; }
.sidebar-logout-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: #dc2626;
  font-size: 11px;
  cursor: pointer;
}
.sidebar-logout-btn:hover { text-decoration: underline; }

/* === メインコンテンツ === */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* チャットエリア */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.message.user {
  align-self: flex-end;
  background: #2563eb;
  color: white;
  border-bottom-right-radius: 4px;
}
.message.assistant {
  align-self: flex-start;
  background: white;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}
.message.system {
  align-self: center;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  border-radius: 8px;
  text-align: center;
}

/* 出典 */
.sources {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
  font-size: 11px;
  color: #6b7280;
}
.sources span {
  display: inline-block;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  margin: 2px 4px 2px 0;
}
.source-tag {
  display: inline-flex !important;
  align-items: center;
  gap: 0;
  padding: 0 6px 0 0 !important;
  overflow: hidden;
}
.source-channel {
  color: white;
  padding: 2px 5px;
  margin-right: 4px;
  border-radius: 3px 0 0 3px;
  font-size: 10px;
  font-weight: 600;
}
.knowledge-source-channel {
  color: white !important;
  background: #e02b2b !important;
  padding: 2px 5px;
  margin-right: 4px;
  border-radius: 3px 0 0 3px;
  font-size: 10px;
  font-weight: 600;
}
.knowledge-source-tag {
  color: #1a1a2e !important;
  background: #f5e6e6 !important;
}
.knowledge-source-tag:hover {
  background: #f0d4d4 !important;
}
.knowledge-sources {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed #d1fae5;
}
.knowledge-tag {
  display: inline-block;
  background: #d1fae5;
  color: #065f46;
  padding: 2px 6px;
  border-radius: 4px;
  margin: 2px 4px 2px 0;
  font-size: 10px;
  text-decoration: none;
}
a.knowledge-tag:hover {
  background: #a7f3d0;
}

/* フィードバックボタン */
.feedback-area {
  margin-top: 6px;
  padding-top: 6px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.fb-btn {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
.fb-btn:hover { background: #f3f4f6; }
.fb-good:hover { border-color: #22c55e; background: #f0fdf4; }
.fb-bad:hover { border-color: #ef4444; background: #fef2f2; }
.fb-done {
  font-size: 12px;
  color: #22c55e;
}
.fb-reason-form {
  width: 100%;
}
.fb-reason-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  resize: vertical;
  font-family: inherit;
}
.fb-submit-btn, .fb-cancel-btn {
  padding: 4px 12px;
  font-size: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.fb-submit-btn {
  background: #3b82f6;
  color: white;
}
.fb-cancel-btn {
  background: #e5e7eb;
  color: #374151;
}

/* フィードバック対話 */
.fb-dialog {
  width: 100%;
  margin-top: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
  background: #fafafa;
  max-height: 300px;
  overflow-y: auto;
}
.fb-dialog-msg {
  margin-bottom: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
}
.fb-dialog-msg.user {
  background: #dbeafe;
  text-align: right;
}
.fb-dialog-msg.assistant {
  background: #f3f4f6;
}
.fb-dialog-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  resize: none;
  font-family: inherit;
  margin-top: 4px;
}
.fb-dialog-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.fb-save-btn {
  padding: 4px 12px;
  font-size: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: #22c55e;
  color: white;
}
.fb-save-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}
.fb-dialog-send-btn {
  padding: 4px 12px;
  font-size: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: #3b82f6;
  color: white;
}
.fb-duplicate-box {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  background: #fffbeb;
  font-size: 12px;
}
.fb-duplicate-box .existing-content {
  background: #fff;
  padding: 6px;
  border-radius: 4px;
  margin: 6px 0;
  font-size: 11px;
  color: #374151;
}
.fb-duplicate-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.fb-merge-btn {
  padding: 4px 10px;
  font-size: 11px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: #f59e0b;
  color: white;
}
.fb-skip-btn {
  padding: 4px 10px;
  font-size: 11px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: #e5e7eb;
  color: #374151;
}

/* ローディング */
.loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: #6b7280;
  font-size: 13px;
}
.loading-dots {
  display: flex;
  gap: 4px;
}
.loading-dots span {
  width: 6px;
  height: 6px;
  background: #9ca3af;
  border-radius: 50%;
  animation: bounce 1.4s infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* 入力エリア */
.input-area {
  background: white;
  border-top: 1px solid #e5e7eb;
  padding: 12px;
  display: flex;
  gap: 8px;
}
.input-area textarea {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  min-height: 38px;
  max-height: 100px;
  outline: none;
}
.input-area textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}
.send-btn {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.send-btn:hover { background: #1d4ed8; }
.send-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* === AIパネル・タイムライン === */
.ai-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}
.ai-panel.active {
  display: flex;
}
.ai-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ai-sub-page {
  flex: 1;
  overflow: hidden;
  display: none;
  flex-direction: column;
}
.ai-sub-page.active {
  display: flex;
  flex-direction: column;
}
.ai-timeline {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fafbfc;
}
.tl-placeholder {
  color: #9ca3af;
  font-size: 13px;
  font-style: italic;
  text-align: center;
  padding: 32px 16px;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.tl-item { animation: fadeInUp 0.3s ease-out; }
.tl-time {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 4px;
}

/* User message */
.tl-user {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 8px;
}
.tl-user .tl-bubble {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  padding: 10px 16px;
  border-radius: 18px 18px 4px 18px;
  max-width: 65%;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(59,130,246,0.3);
  word-wrap: break-word;
}

/* Thinking */
.tl-thinking {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}
.tl-think-icon { font-size: 13px; }
.tl-think-text {
  color: #9ca3af;
  font-size: 12px;
  font-style: italic;
}
@keyframes pulse { 0%,100%{opacity:0.5} 50%{opacity:1} }
.tl-thinking { animation: pulse 2s ease-in-out infinite; }

/* Tool execution - compact inline */
.tl-tool {
  padding: 1px 0;
}
.tl-tool-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
}
.tl-tool-icon { font-size: 12px; }
.tl-tool-name {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 11px;
  color: #475569;
}
.tl-tool-badge {
  background: #e2e8f0;
  color: #64748b;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}
.tl-tool-badge.done {
  background: #dcfce7;
  color: #166534;
}

/* AI response */
.tl-assistant {
  display: flex;
  align-items: flex-start;
}
.tl-assistant .tl-content {
  background: white;
  border: 1px solid #e5e7eb;
  padding: 9px 14px;
  border-radius: 4px 16px 16px 16px;
  max-width: 85%;
  font-size: 13px;
  line-height: 1.6;
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  word-wrap: break-word;
}
.tl-assistant .tl-content strong { font-weight: 600; }

/* デュアル回答（シンプル/詳細切替） */
.tl-dual-answer { padding: 0 !important; overflow: hidden; }
.tl-dual-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  border-radius: 4px 16px 0 0;
}
.tl-dual-tab {
  flex: 1;
  padding: 6px 0;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.15s, box-shadow 0.15s;
}
.tl-dual-tab:hover { color: #475569; }
.tl-dual-tab.active {
  color: #2563eb;
  box-shadow: inset 0 -2px 0 #2563eb;
}
.tl-dual-body {
  display: none;
  padding: 9px 14px;
}
.tl-dual-body.active { display: block; }

/* システムAGT申請ボタン（回答の下） */
.tl-sagt-apply-btn {
  display: block;
  width: calc(100% - 20px);
  margin: 8px 10px 10px;
  padding: 6px 14px;
  font-size: 12px;
  color: #3b82f6;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.tl-sagt-apply-btn:hover {
  color: #fff;
  border-color: #3b82f6;
  background: #3b82f6;
}

/* システムAGT申請ステータス表示 */
.tl-sagt-status-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 8px;
  font-size: 12px;
  color: #3b82f6;
}

/* システムAGT申請プレビューカード */
.tl-sagt-preview-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  max-width: 100%;
}
.tl-sagt-preview-header {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 12px;
}
.tl-sagt-field {
  margin-bottom: 10px;
}
.tl-sagt-field label {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
  font-weight: 500;
}
.tl-sagt-field input,
.tl-sagt-field textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #1e293b;
  box-sizing: border-box;
  font-family: inherit;
  resize: vertical;
}
.tl-sagt-field input:focus,
.tl-sagt-field textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.tl-sagt-preview-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}
.tl-sagt-cancel {
  padding: 6px 14px;
  font-size: 12px;
  color: #64748b;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.tl-sagt-cancel:hover {
  background: #f1f5f9;
}
.tl-sagt-submit {
  padding: 6px 14px;
  font-size: 12px;
  color: #fff;
  background: #3b82f6;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}
.tl-sagt-submit:hover {
  background: #2563eb;
}
.tl-sagt-submit:disabled {
  background: #93c5fd;
  cursor: not-allowed;
}
.tl-sagt-success {
  padding: 10px 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  color: #166534;
  font-size: 13px;
}

/* Markdown table */
.tl-table {
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0;
  width: 100%;
}
.tl-table th {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: #475569;
}
.tl-table td {
  border: 1px solid #e2e8f0;
  padding: 5px 10px;
  font-size: 12px;
}
.tl-table tr:nth-child(even) { background: #f8fafc; }

.tl-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.tl-loading-dots {
  display: flex;
  gap: 4px;
}
.tl-loading-dots span {
  width: 6px;
  height: 6px;
  background: #93c5fd;
  border-radius: 50%;
  animation: loadingBounce 1.4s ease-in-out infinite both;
}
.tl-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.tl-loading-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes loadingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
.tl-loading-text {
  font-size: 12px;
  color: #93c5fd;
}


.tl-reply-block {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  margin: 8px 0;
  overflow: hidden;
}
.tl-reply-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #e0f2fe;
  font-size: 12px;
  font-weight: 600;
  color: #0369a1;
}
.tl-reply-copy {
  background: #0284c7;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 3px 12px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s;
}
.tl-reply-copy:hover { background: #0369a1; }
.tl-reply-body {
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.7;
  color: #1e293b;
  white-space: pre-wrap;
}


/* Error */
.tl-error {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 12px;
  color: #dc2626;
  font-size: 13px;
}

/* Input area */
.ai-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: white;
  border-top: 1px solid #f1f5f9;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.03);
  flex-shrink: 0;
}
.ai-input-area textarea {
  flex: 1;
  resize: none;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s;
  min-height: 44px;
  max-height: 200px;
  overflow-y: hidden;
}
.ai-input-area textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.ai-input-area button {
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 12px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.ai-input-area button:hover { background: #2563eb; }
.ai-input-area button:disabled { background: #93c5fd; cursor: not-allowed; }

/* エージェントツールバー */
.agent-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-bottom: 1px solid #f1f5f9;
  background: white;
  flex-shrink: 0;
}
.agent-toolbar-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  color: #475569;
  cursor: pointer;
}
.agent-toolbar-btn:hover { background: #f1f5f9; }
.agent-new-session-btn {
  flex-shrink: 0;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.agent-new-session-btn:hover { background: #1d4ed8; }
.agent-dropdown { position: relative; }
.agent-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 100;
  min-width: 320px;
  max-height: 300px;
  overflow-y: auto;
}
.agent-session-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.agent-session-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}
.agent-session-table tr:hover { background: #f8fafc; }
.agent-session-table .session-date { color: #9ca3af; white-space: nowrap; width: 90px; }
.agent-session-table .session-title { color: #1e293b; }
.agent-load-more-btn {
  width: 100%;
  padding: 8px;
  border: none;
  background: #f8fafc;
  color: #3b82f6;
  font-size: 11px;
  cursor: pointer;
  border-top: 1px solid #e2e8f0;
}
.agent-load-more-btn:hover { background: #eff6ff; }

.ai-report-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ウェルカム画面 */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 32px;
  text-align: center;
  color: #6b7280;
}
.welcome h2 {
  font-size: 18px;
  color: #1f2937;
  margin-bottom: 8px;
}
.welcome p {
  font-size: 13px;
  margin-bottom: 16px;
}
.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 280px;
}
.welcome-btn {
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: white;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.welcome-btn:hover {
  border-color: #2563eb;
  background: #eff6ff;
}
.welcome-btn strong {
  display: block;
  color: #1f2937;
  margin-bottom: 2px;
}
.welcome-btn span {
  color: #6b7280;
  font-size: 12px;
}

/* 管理画面 */
.admin-panel {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: none;
}
.admin-panel.active {
  display: block;
}
.admin-section {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}
.admin-section h3 {
  font-size: 14px;
  color: #1f2937;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3f4f6;
}
/* ── 同期データパネル共通スタイル ── */
.sync-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.sync-panel-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  border-bottom: none;
  padding-bottom: 0;
}
.sync-summary-card {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: 8px;
}
.sync-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sync-summary-label {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sync-summary-value {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}
.sync-badge-confirmed {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 600;
  background: #d1fae5;
  color: #065f46;
}
.sync-badge-provisional {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
}
.sync-table {
  width: 100%;
  font-size: 12px;
  border-collapse: separate;
  border-spacing: 0;
}
.sync-table thead th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 11px;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 1;
}
.sync-table tbody tr {
  transition: background 0.15s;
}
.sync-table tbody tr:nth-child(even) {
  background: #f8fafc;
}
.sync-table tbody tr:hover {
  background: #eff6ff;
}
.sync-table tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}
.sync-table .cell-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.sync-table .cell-muted {
  font-size: 11px;
  color: #94a3b8;
}
/* AGT実行基盤（runtime policy）管理UI */
.agt-rt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.agt-rt-note {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 12px;
  line-height: 1.5;
}
.agt-rt-table td, .agt-rt-table th {
  vertical-align: middle;
}
.agt-rt-select, .agt-rt-input {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
}
.agt-rt-model { width: 130px; }
.agt-rt-timeout { width: 80px; }
.agt-rt-input:disabled {
  background: #f3f4f6;
  color: #9ca3af;
}
.agt-rt-row.agt-rt-dirty td {
  background: #fffbeb;
}
.agt-rt-status {
  font-size: 11px;
  margin-left: 6px;
}
.agt-rt-status.agt-rt-ok { color: #16a34a; }
.agt-rt-status.agt-rt-err { color: #dc2626; }
.sync-btn-reload {
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 600;
  color: #3b82f6;
  background: white;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.sync-btn-reload:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}
/* RPP アコーディオン */
.rpp-month-row {
  cursor: pointer;
  user-select: none;
}
.rpp-month-row:hover {
  background: #dbeafe !important;
}
.rpp-month-row td:first-child::before {
  content: "\25B6";
  display: inline-block;
  margin-right: 6px;
  font-size: 9px;
  color: #64748b;
  transition: transform 0.2s;
}
.rpp-month-row.expanded td:first-child::before {
  transform: rotate(90deg);
}
.rpp-month-row td {
  font-weight: 600;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}
.rpp-day-row {
  display: none;
}
.rpp-day-row.visible {
  display: table-row;
}
.rpp-day-row td {
  padding-left: 28px;
  font-size: 11px;
}
/* 会話履歴パネル */
.history-panel {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  max-height: 280px;
  overflow-y: auto;
  flex-shrink: 0;
}
.history-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid #f3f4f6;
  position: sticky;
  top: 0;
  background: white;
}
.history-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}
.history-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #f9fafb;
  gap: 6px;
}
.history-item:hover { background: #f9fafb; }
.history-item-body {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.history-item-title {
  font-size: 12px;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-date {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}
.history-resume-btn {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: white;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.history-resume-btn:hover { background: #f3f4f6; }
.history-del-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #d1d5db;
  font-size: 13px;
  padding: 2px;
  flex-shrink: 0;
}
.history-del-btn:hover { color: #ef4444; }
.history-empty {
  padding: 20px 12px;
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
}

/* ナレッジ管理 */
.km-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.km-form-row {
  display: flex;
  gap: 8px;
}
.km-form select, .km-form input[type="text"] {
  flex: 1;
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
}
.km-form textarea {
  width: 100%;
  padding: 7px 8px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  resize: vertical;
  color: #374151;
  box-sizing: border-box;
}
.km-status {
  font-size: 11px;
  min-height: 16px;
  color: #6b7280;
}
.km-status.ok { color: #059669; }
.km-status.err { color: #dc2626; }
.km-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}
.km-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 11px;
}
.km-item-body {
  flex: 1;
  min-width: 0;
}
.km-item-meta {
  display: flex;
  gap: 6px;
  margin-bottom: 3px;
}
.km-badge {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  background: #dbeafe;
  color: #1e40af;
}
.km-badge.product { background: #d1fae5; color: #065f46; }
.km-item-content {
  color: #374151;
  word-break: break-all;
  line-height: 1.5;
}
.km-del-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}
.km-del-btn:hover { color: #dc2626; }
.km-empty {
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
  padding: 12px 0;
}

/* マニュアルURL管理 */
.ms-url-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}
.ms-url-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  font-size: 11px;
}
.ms-url-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #1d4ed8;
}
.ms-url-title {
  flex-shrink: 0;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #6b7280;
}
.ms-del-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
  line-height: 1;
}
.ms-del-btn:hover { color: #dc2626; }
.ms-empty {
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
  padding: 12px 0;
}
.ms-status {
  font-size: 11px;
  min-height: 16px;
  color: #6b7280;
}
.ms-status.ok { color: #059669; }
.ms-status.err { color: #dc2626; }
.ms-crawl-progress {
  margin-bottom: 8px;
  padding: 8px 10px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  font-size: 11px;
}
.ms-crawl-bar-bg {
  background: #e0f2fe;
  border-radius: 3px;
  height: 5px;
  margin: 5px 0;
}
.ms-crawl-bar {
  background: #0284c7;
  height: 5px;
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s;
}
.ms-crawl-url {
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}
.ms-crawl-stop-btn {
  background: none;
  border: 1px solid #dc2626;
  color: #dc2626;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 10px;
  cursor: pointer;
}
.ms-crawl-stop-btn:hover { background: #fee2e2; }
.ms-fetched { color: #059669; font-size: 10px; flex-shrink: 0; }

.sync-loading {
  color: #9ca3af;
  font-size: 12px;
  padding: 8px 0;
}
.sync-btn {
  margin-top: 12px;
  width: 100%;
  padding: 10px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.sync-btn:hover { background: #1d4ed8; }
.sync-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}
.sync-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3f4f6;
}
.sync-table-header h3 {
  font-size: 14px;
  color: #1f2937;
  margin: 0;
  padding: 0;
  border: none;
}
.sync-refresh-btn {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 11px;
  color: #6b7280;
  cursor: pointer;
}
.sync-refresh-btn:hover { background: #f3f4f6; }
.sync-table {
  width: 100%;
  border-collapse: collapse;
}
#dataSyncView {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}
.sync-table th {
  text-align: left;
  font-size: 10px;
  color: #9ca3af;
  font-weight: 500;
  padding: 0 6px 6px;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
}
.sync-table th:last-child { text-align: right; }
.sync-table td {
  padding: 7px 6px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 12px;
  vertical-align: middle;
}
.sync-table tr:last-child td { border-bottom: none; }
/* 外部リクエスト統計 */
.request-stats { margin-bottom: 16px; }
.request-stats-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid #f3f4f6;
}
.request-stats-header h3 { font-size: 14px; color: #1f2937; margin: 0; padding: 0; border: none; }
.request-stats-summary {
  display: flex; gap: 16px; margin-bottom: 10px; font-size: 12px; color: #6b7280;
}
.request-stats-summary .stat-value { font-weight: 600; color: #1f2937; }
.request-bar-list { display: flex; flex-direction: column; gap: 4px; }
.request-bar-row {
  display: flex; align-items: center; gap: 8px; font-size: 11px;
}
.request-bar-label { width: 80px; text-align: right; color: #6b7280; flex-shrink: 0; }
.request-bar-track { flex: 1; height: 14px; background: #f3f4f6; border-radius: 3px; overflow: hidden; }
.request-bar-fill { height: 100%; border-radius: 3px; min-width: 2px; }
.request-bar-count { width: 50px; font-size: 11px; color: #374151; }
.request-detail-toggle {
  background: none; border: none; font-size: 11px; color: #6366f1;
  cursor: pointer; padding: 4px 0; margin-top: 4px;
}
.request-detail-toggle:hover { text-decoration: underline; }
.request-detail-table { display: none; margin-top: 8px; }
.request-detail-table.show { display: block; }
.request-detail-table table { width: 100%; border-collapse: collapse; font-size: 11px; }
.request-detail-table th { text-align: left; color: #9ca3af; padding: 3px 6px; border-bottom: 1px solid #e5e7eb; }
.request-detail-table td { padding: 3px 6px; border-bottom: 1px solid #f3f4f6; color: #374151; }
.sync-channel { font-weight: 500; color: #1f2937; white-space: nowrap; }
.sync-type-cell { color: #6b7280; font-size: 11px; white-space: nowrap; }
.sync-daily-col { text-align: center; font-size: 10px; padding: 0 2px !important; min-width: 28px; }
.sync-daily-col.hidden-col { display: none; }
th.sync-daily-col { color: #9ca3af; font-weight: 500; }
td.sync-daily-col { font-size: 13px; }
#toggleDailyColsBtn.active { background: #eff6ff; border-color: #6366f1; color: #6366f1; }
.sync-detail-cell { color: #374151; }
.sync-time-cell { color: #9ca3af; font-size: 11px; white-space: nowrap; }
.sync-next-cell { color: #9ca3af; font-size: 11px; white-space: nowrap; }
.sync-action-cell { text-align: right; white-space: nowrap; }
.sort-th { cursor: pointer; user-select: none; }
.sort-th:hover { color: #6b7280; }
.sort-icon { font-size: 9px; margin-left: 2px; opacity: 0.5; }
.sort-th.asc .sort-icon { opacity: 1; }
.sort-th.asc .sort-icon::after { content: "▲"; }
.sort-th.desc .sort-icon::after { content: "▼"; }
.sort-th:not(.asc):not(.desc) .sort-icon::after { content: "⇅"; }
.sync-btn-sm {
  padding: 3px 10px;
  font-size: 11px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.sync-btn-sm:hover { background: #1d4ed8; }
.sync-btn-sm:disabled { background: #9ca3af; cursor: not-allowed; font-size: 10px; }
.sync-env-badge { font-size: 9px; padding: 1px 6px; border-radius: 3px; font-weight: 600; }
.sync-env-badge.env-workers { background: #fef3c7; color: #92400e; }
.sync-env-badge.env-gcp { background: #dbeafe; color: #1e40af; }
.sync-env-badge.env-gas { background: #e0e7ff; color: #3730a3; }
.sync-method-badge { font-size: 9px; padding: 1px 6px; border-radius: 3px; font-weight: 600; }
.sync-method-badge.method-api { background: #d1fae5; color: #065f46; }
.sync-method-badge.method-web { background: #fce7f3; color: #9d174d; }
.sync-method-badge.method-gas { background: #e0e7ff; color: #3730a3; }
.sync-btn-auth { background: #ef4444; margin-left: 4px; }
.sync-btn-auth:hover { background: #dc2626; }
.yahoo-auth-btn { margin-left: 4px; font-size: 10px; padding: 2px 8px; border-radius: 3px; color: #fff; border: none; cursor: pointer; background: #ef4444; }
.yahoo-auth-btn.auth-ok { background: #22c55e; }
.yahoo-auth-btn.auth-ok:hover { background: #16a34a; }
.yahoo-auth-btn.auth-warn { background: #ef4444; }
.yahoo-auth-btn.auth-warn:hover { background: #dc2626; }
.yahoo-auth-btn.auth-unknown { background: #9ca3af; }
.yahoo-auth-expiry { font-size: 9px; color: #6b7280; margin-top: 1px; text-align: right; }
.yahoo-auth-expiry.expiry-warn { color: #ef4444; font-weight: bold; }
/* 同期セクションヘッダー */
tr.sync-section-header td {
  padding: 10px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}
tr.sync-section-header:first-child td { padding-top: 0; }
/* 同期ログアコーディオン */
tr.sync-data-row { cursor: pointer; }
tr.sync-data-row:hover { background: #f9fafb; }
tr.sync-data-row.expanded { background: #eff6ff; }
tr.sync-log-panel td { padding: 0 !important; background: #f8fafc; }
.sync-log-wrap { padding: 8px 12px 10px; }
.sync-log-filters { display: flex; gap: 4px; margin-bottom: 6px; }
.sync-log-filter-btn {
  padding: 2px 8px; font-size: 10px; border: 1px solid #d1d5db;
  border-radius: 10px; background: white; cursor: pointer; color: #6b7280;
}
.sync-log-filter-btn.active { background: #2563eb; color: white; border-color: #2563eb; }
.sync-log-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.sync-log-table th { text-align: left; color: #9ca3af; padding: 3px 6px; border-bottom: 1px solid #e5e7eb; font-weight: 500; }
.sync-log-table td { padding: 3px 6px; border-bottom: 1px solid #f3f4f6; color: #374151; }
.sync-log-table .log-success { color: #059669; }
.sync-log-table .log-error { color: #dc2626; }
.sync-log-error-cell { max-width: 220px; }
.sync-log-error-scroll { overflow-x: auto; white-space: nowrap; max-width: 220px; font-size: 10px; color: #dc2626; scrollbar-width: thin; }
.sync-log-error-scroll::-webkit-scrollbar { height: 4px; }
.sync-log-error-scroll::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }
.sync-log-more-btn {
  display: block; width: 100%; margin-top: 6px; padding: 4px;
  font-size: 11px; color: #6b7280; background: white; border: 1px solid #e5e7eb;
  border-radius: 4px; cursor: pointer; text-align: center;
}
.sync-log-more-btn:hover { background: #f3f4f6; }
.sync-log-empty { color: #9ca3af; font-size: 11px; padding: 8px 0; text-align: center; }
.sync-log-stats { font-size: 10px; color: #9ca3af; margin-top: 4px; }
/* Chatworkルーム管理カード */
.room-manager-card {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 10px;
}
.room-manager-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.room-manager-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.room-manager-chevron {
  font-size: 10px;
  color: #6b7280;
  line-height: 1;
}
.room-manager-title {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}
.room-manager-body {
  margin-top: 8px;
}
/* 登録済みルーム: チップ（横並び） */
.room-chip-container { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 0; }
.room-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 3px 6px 3px 9px;
  font-size: 11px;
  color: #374151;
  max-width: 160px;
}
.room-chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 0;
  line-height: 1;
  font-size: 14px;
  flex-shrink: 0;
}
.room-chip-remove:hover { color: #ef4444; }
/* 追加可能ルーム: 縦リスト（既存） */
.room-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 12px;
}
.room-list-item:last-child { border-bottom: none; }
.room-list-name { color: #374151; }
.room-list-meta { color: #9ca3af; font-size: 11px; margin-left: 4px; }
.room-list-empty { color: #9ca3af; font-style: italic; font-size: 12px; padding: 4px 0; }
.room-section-label {
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
  margin: 8px 0 4px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}
.btn-danger-sm {
  padding: 2px 8px;
  font-size: 11px;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  cursor: pointer;
}
.btn-danger-sm:hover { background: #fecaca; }
.btn-add-sm {
  padding: 2px 8px;
  font-size: 11px;
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
  border-radius: 4px;
  cursor: pointer;
}
.btn-add-sm:hover { background: #a7f3d0; }
.btn-add-sm:disabled { background: #e5e7eb; color: #9ca3af; border-color: #d1d5db; cursor: not-allowed; }

/* 一括承認バー */
.bulk-approve-bar {
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.bulk-approve-btn {
  flex: 1;
  padding: 10px;
  background: #22c55e;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.bulk-approve-btn:hover { background: #16a34a; }
.bulk-approve-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* アコーディオン */
.accordion-section { border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.accordion-header { display: flex; align-items: center; padding: 12px 16px; background: #f9fafb; cursor: pointer; font-weight: 600; font-size: 14px; gap: 8px; user-select: none; }
.accordion-header:hover { background: #f3f4f6; }
.accordion-arrow { margin-left: auto; font-size: 10px; color: #9ca3af; }
.accordion-body { display: none; padding: 12px 16px; }
.accordion-section.open .accordion-body { display: block; }
.accordion-badge { background: #ef4444; color: white; font-size: 11px; padding: 1px 7px; border-radius: 10px; font-weight: 600; }
.accordion-badge:empty { display: none; }
/* DB一覧テーブル */
.db-overview-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.db-overview-table th { background: #f3f4f6; padding: 6px 8px; text-align: left; font-weight: 600; color: #374151; border-bottom: 2px solid #e5e7eb; white-space: nowrap; }
.db-overview-table td { padding: 5px 8px; border-bottom: 1px solid #f3f4f6; vertical-align: top; }
.db-overview-table tr:hover td { background: #f9fafb; }
.db-overview-table .db-table-list { color: #6b7280; font-family: monospace; font-size: 10px; }
.db-overview-table .db-tool-chip { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; margin: 1px 2px; background: #e0e7ff; color: #3730a3; }
.db-overview-table .db-schema-link { color: #2563eb; cursor: pointer; text-decoration: underline; font-size: 10px; }
.db-overview-table .db-schema-link:hover { color: #1d4ed8; }
.db-overview-table .db-no-schema { color: #9ca3af; font-style: italic; font-size: 10px; }
/* プロンプト管理用 */
.prompt-category-header { font-size: 13px; font-weight: 700; color: #374151; padding: 8px 0 4px; border-bottom: 1px solid #e5e7eb; margin-bottom: 4px; }
.prompt-item { border: 1px solid #e5e7eb; border-radius: 6px; overflow: hidden; }
.prompt-item-header { display: flex; align-items: center; padding: 8px 12px; background: #f9fafb; cursor: pointer; font-size: 12px; gap: 6px; user-select: none; }
.prompt-item-header:hover { background: #f3f4f6; }
.prompt-item-header .arrow { font-size: 9px; color: #9ca3af; transition: transform 0.15s; }
.prompt-item.open .prompt-item-header .arrow { transform: rotate(90deg); }
.prompt-item-body { display: none; padding: 8px 12px; background: #fff; }
.prompt-item.open .prompt-item-body { display: block; }
.prompt-item-name { font-weight: 600; flex: 1; }
.prompt-modified-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; display: none; }
.prompt-item.modified .prompt-modified-dot { display: inline-block; }
.prompt-textarea { width: 100%; min-height: 120px; resize: vertical; border: 1px solid #d1d5db; border-radius: 4px; padding: 8px; font-family: monospace; font-size: 11px; line-height: 1.5; box-sizing: border-box; }
.prompt-textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.prompt-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.prompt-char-count { font-size: 10px; color: #9ca3af; }
.prompt-meta { font-size: 10px; color: #9ca3af; margin-top: 4px; }
.prompt-save-btn { padding: 4px 14px; border: none; background: #2563eb; color: #fff; border-radius: 4px; font-size: 11px; cursor: pointer; }
.prompt-save-btn:hover { background: #1d4ed8; }
.prompt-save-btn:disabled { background: #9ca3af; cursor: default; }
.prompt-reset-btn { padding: 4px 14px; border: 1px solid #d1d5db; background: #fff; color: #374151; border-radius: 4px; font-size: 11px; cursor: pointer; }
.prompt-reset-btn:hover { background: #f3f4f6; }
.prompt-reset-btn:disabled { color: #d1d5db; cursor: default; }
.review-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
}
.review-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.review-category {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.review-category.image_ocr { background: #dbeafe; color: #1e40af; }
.review-category.feedback_correction { background: #fef3c7; color: #92400e; }
.review-category.ai_suggestion { background: #ede9fe; color: #5b21b6; }
.review-category.chatwork_extraction { background: #d1fae5; color: #065f46; }
.review-title {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}
.review-image { margin: 8px 0; }
.review-image img {
  display: block;
  max-width: 100%;
  max-height: 300px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
}
.review-data-edit {
  display: block;
  width: 100%;
  font-size: 12px;
  font-family: inherit;
  color: #374151;
  background: #f9fafb;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin: 8px 0;
  white-space: pre-wrap;
  min-height: 80px;
  max-height: 300px;
  overflow-y: auto;
  resize: vertical;
  line-height: 1.5;
}
.review-data-edit:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.review-context {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 8px;
}
.review-actions {
  display: flex;
  gap: 8px;
}
.review-actions button {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}
.review-approve { background: #22c55e; color: white; }
.review-approve:hover { background: #16a34a; }
.review-skip { background: #e5e7eb; color: #374151; }
.review-skip:hover { background: #d1d5db; }
.review-reject { background: #ef4444; color: white; }
.review-reject:hover { background: #dc2626; }
.review-empty {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  padding: 40px 0;
}
.review-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 4px;
}
.review-stat {
  font-size: 12px;
  color: #6b7280;
}
.review-stat strong {
  color: #1f2937;
}

/* デバッグパネル */
.debug-toggle {
  margin-top: 6px;
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.debug-toggle:hover { color: #6b7280; }
.debug-toggle .arrow {
  display: inline-block;
  transition: transform 0.2s;
  font-size: 9px;
}
.debug-toggle.open .arrow { transform: rotate(90deg); }
.debug-panel {
  display: none;
  margin-top: 6px;
  padding: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.5;
  color: #475569;
  max-height: 300px;
  overflow-y: auto;
}
.debug-panel.open { display: block; }
.debug-row {
  display: flex;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid #f1f5f9;
}
.debug-row:last-child { border-bottom: none; }
.debug-step {
  flex-shrink: 0;
  font-weight: 600;
  color: #334155;
  min-width: 140px;
}
.debug-detail {
  color: #64748b;
  word-break: break-all;
}

/* 統合顧客対応パネル */
.customer-support-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.customer-support-panel.active { display: flex; }

/* サブタブバー */
.sub-tab-bar {
  display: none !important;
}
.sub-tab-btn {
  padding: 5px 14px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  color: #6b7280;
  border-radius: 14px;
  transition: all 0.15s;
}
.sub-tab-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  font-weight: 600;
}

/* サブパネル */
.sub-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  gap: 12px;
}
.sub-panel.active { display: flex; }
.gmail-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 6px;
  border-bottom: 1px solid #e5e7eb;
}
.gmail-toolbar label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #6b7280;
  cursor: pointer;
}
.gmail-pending-badge {
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 4px;
}
.gmail-email-card {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  background: #fff;
}
.gmail-email-card:hover { background: #f9fafb; }
.gmail-email-card.unread { border-left: 3px solid #2563eb; }
.gmail-email-from {
  font-size: 12px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 2px;
}
.gmail-email-subject {
  font-size: 12px;
  color: #374151;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gmail-email-preview {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gmail-email-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.gmail-email-date { font-size: 10px; color: #9ca3af; }
.gmail-replied-badge {
  font-size: 10px;
  background: #d1fae5;
  color: #065f46;
  border-radius: 4px;
  padding: 1px 5px;
}
.gmail-detail-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #2563eb;
  cursor: pointer;
  padding: 4px 0 8px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 8px;
}
.gmail-subject-line {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}
.gmail-from-line {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 10px;
}
.gmail-thread { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.gmail-msg {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.gmail-msg.customer { background: #f3f4f6; }
.gmail-msg.store { background: #eff6ff; }
.gmail-msg-header {
  font-size: 10px;
  color: #9ca3af;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}
.gmail-empty {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  padding: 40px 16px;
}
.gmail-auth-section {
  text-align: center;
  padding: 30px 16px;
}
.gmail-auth-section p { font-size: 12px; color: #6b7280; margin-bottom: 12px; }

.inquiry-empty {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  padding: 40px 16px;
}
.inquiry-empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
}
.inquiry-hint {
  font-size: 11px;
  color: #d1d5db;
  margin-top: 8px;
}

.inquiry-error {
  background: #fef2f2;
  color: #991b1b;
  padding: 12px;
  border-radius: 8px;
  font-size: 12px;
  border: 1px solid #fecaca;
}

.inquiry-header {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.inquiry-category-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  background: #dbeafe;
  color: #1e40af;
}
.inquiry-type-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #f3f4f6;
  color: #374151;
}

.inquiry-meta {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #374151;
  line-height: 1.8;
}
.inquiry-number {
  font-size: 11px;
  color: #6b7280;
  word-break: break-all;
}

/* 注文サマリー */
.inq-order-summary {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #e5e7eb;
  font-size: 11px;
  color: #374151;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.inq-os-row {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
}
.inq-os-label {
  color: #9ca3af;
  flex-shrink: 0;
  min-width: 52px;
}
.inq-os-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.inq-os-notes {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.inq-os-note {
  color: #b45309;
  word-break: break-all;
}
.inq-os-notes-row .inq-os-label {
  color: #b45309;
}

.inquiry-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.inquiry-msg {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.inquiry-msg.user {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}
.inquiry-msg.merchant {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-bottom-right-radius: 4px;
}
.inquiry-msg-header {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}
.inquiry-msg-from {
  font-weight: 600;
  color: #374151;
}
.inquiry-msg-from.merchant {
  color: #1e40af;
}
.inquiry-attachments {
  margin-top: 6px;
}
.inquiry-attachment-img {
  margin-top: 4px;
}
.inquiry-attachment-image {
  max-width: 100%;
  max-height: 200px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
}
.inquiry-attachment-image:hover {
  opacity: 0.85;
}
.inquiry-attachment-file {
  font-size: 11px;
  color: #6b7280;
  padding: 4px 8px;
  background: #f3f4f6;
  border-radius: 4px;
  margin-top: 4px;
  display: inline-block;
}

.inquiry-generate-btn {
  width: 100%;
  padding: 12px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.inquiry-generate-btn:hover { background: #1d4ed8; }
.inquiry-generate-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.inquiry-draft-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.inquiry-draft-header h4 {
  font-size: 13px;
  color: #1f2937;
  margin: 0;
}
.inquiry-char-count {
  font-size: 11px;
  color: #6b7280;
}
.inquiry-char-count.over {
  color: #ef4444;
  font-weight: 600;
}

.inquiry-draft {
  width: 100%;
  min-height: 160px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  color: #1f2937;
}
.inquiry-draft:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.inquiry-draft-actions {
  display: flex;
  gap: 8px;
}
.inquiry-send-btn {
  flex: 1;
  padding: 10px;
  background: #22c55e;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.inquiry-send-btn:hover { background: #16a34a; }
.inquiry-send-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}
.inquiry-regenerate-btn {
  padding: 10px 16px;
  background: #e5e7eb;
  color: #374151;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.inquiry-regenerate-btn:hover { background: #d1d5db; }
.inquiry-regenerate-btn:disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

#inqSendStatus {
  font-size: 12px;
  padding: 4px 0;
}

/* --- 明示的フィードバック UI --- */
.inquiry-feedback-section {
  margin-top: 8px;
  border-top: 1px solid #e5e7eb;
  padding-top: 8px;
}
.inquiry-feedback-toggle-btn {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}
.inquiry-feedback-toggle-btn:hover { color: #374151; }
.inquiry-feedback-form {
  margin-top: 8px;
  flex-direction: column;
  gap: 6px;
}
.inquiry-feedback-label {
  font-size: 12px;
  color: #374151;
}
.inquiry-feedback-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  color: #1f2937;
  box-sizing: border-box;
}
.inquiry-feedback-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}
.inquiry-feedback-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.inquiry-feedback-save-btn {
  padding: 6px 14px;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.inquiry-feedback-save-btn:hover { background: #4f46e5; }
.inquiry-feedback-save-btn:disabled { background: #9ca3af; cursor: not-allowed; }
.inquiry-feedback-cancel-btn {
  font-size: 12px;
  color: #9ca3af;
  cursor: pointer;
}
.inquiry-feedback-cancel-btn:hover { color: #6b7280; }
.inquiry-feedback-status {
  font-size: 12px;
  color: #6b7280;
  min-height: 16px;
}

.send-success {
  color: #16a34a;
  font-weight: 500;
}
.send-error {
  color: #dc2626;
}

/* 相談パネル */
.inq-analysis-summary {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #1e40af;
  line-height: 1.5;
  margin-bottom: 10px;
}
.inq-stage-badge {
  display: inline-block;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 10px;
}
.inq-proposals {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.inq-proposal-card {
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
}
.inq-proposal-card:hover {
  border-color: #93c5fd;
  background: #f0f9ff;
}
.inq-proposal-card.selected {
  border-color: #2563eb;
  background: #eff6ff;
}
.inq-proposal-card .proposal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.inq-proposal-card .proposal-label {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}
.inq-proposal-card .proposal-confidence {
  font-size: 11px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 8px;
}
.inq-proposal-card .proposal-template {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 2px;
}
.inq-proposal-card .proposal-reasoning {
  font-size: 12px;
  color: #4b5563;
  line-height: 1.4;
}
.inq-proposal-generate-btn {
  width: 100%;
  padding: 10px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
}
.inq-proposal-generate-btn:hover { background: #1d4ed8; }
.inq-proposal-generate-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}
.inq-custom-direction {
  margin-bottom: 10px;
}
.inq-custom-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 12px;
  resize: vertical;
  font-family: inherit;
  margin-bottom: 6px;
}
.inq-custom-input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124,58,237,0.15);
}
.inq-custom-submit {
  width: 100%;
  padding: 8px;
  background: #7c3aed;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.inq-custom-submit:hover { background: #6d28d9; }
.inq-custom-submit:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}
#inqKnowledgeArea {
  margin-bottom: 8px;
}

/* ログインオーバーレイ */
#loginOverlay {
  position: fixed;
  inset: 0;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
#maintenanceOverlay {
  position: fixed;
  inset: 0;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
}
.maintenance-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 32px 36px;
  width: min(360px, calc(100vw - 32px));
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  text-align: center;
}
.maintenance-card h2 {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 14px;
}
.maintenance-card p {
  font-size: 13px;
  color: #374151;
  margin: 6px 0;
}
.maintenance-card .maintenance-sub {
  color: #6b7280;
  font-size: 12px;
  margin-top: 18px;
}
.login-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 32px 28px;
  width: 280px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.login-card h2 {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px;
}
.login-card p {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 20px;
}
.login-input {
  width: 100%;
  padding: 9px 10px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  margin-bottom: 10px;
  box-sizing: border-box;
  color: #111827;
}
.login-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}
.login-btn {
  width: 100%;
  padding: 10px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}
.login-btn:hover { background: #1d4ed8; }
.login-btn:disabled { background: #9ca3af; cursor: not-allowed; }
.login-error {
  margin-top: 10px;
  padding: 8px 10px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  font-size: 12px;
  color: #dc2626;
}
/* ヘッダーユーザー情報 */
.header-user {
  font-size: 11px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-logout-btn {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  color: #374151;
}
.header-logout-btn:hover { background: #f3f4f6; }

/* 同期中スピナー（管理タブボタン横） */
.admin-sync-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid #d1d5db;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: admin-spin 0.8s linear infinite;
  margin-left: 4px;
  vertical-align: middle;
}
@keyframes admin-spin {
  to { transform: rotate(360deg); }
}

/* 通関ファイルアップロード中スピナー */
.cc-upload-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid #c7d2fe;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: cc-spin 0.6s linear infinite;
}
@keyframes cc-spin {
  to { transform: rotate(360deg); }
}

/* 管理タブ サブタブ */
.admin-sub-tab-bar {
  display: none !important;
}
.admin-sub-tab-btn {
  padding: 5px 12px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  color: #6b7280;
  border-radius: 14px;
  transition: all 0.15s;
}
.admin-sub-tab-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  font-weight: 600;
}
.admin-sub-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}
.admin-sub-panel.active { display: flex; }

.backup-admin {
  padding: 16px;
  gap: 14px;
}
.backup-admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.backup-admin-header h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: #111827;
}
.backup-muted {
  font-size: 12px;
  color: #6b7280;
}
.backup-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.backup-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.backup-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.backup-card-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}
.backup-card-value {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}
.backup-card-sub {
  font-size: 12px;
  color: #4b5563;
  margin-top: 6px;
  line-height: 1.45;
}
.backup-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  margin: 14px 0 6px;
}
.backup-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #e5e7eb;
  font-size: 12px;
}
.backup-table th,
.backup-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}
.backup-table th {
  background: #f9fafb;
  color: #374151;
  font-weight: 700;
}
.backup-status {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 11px;
  font-weight: 700;
}
.backup-status.ok {
  background: #dcfce7;
  color: #166534;
}
.backup-status.warn {
  background: #fef3c7;
  color: #92400e;
}
.backup-status.bad {
  background: #fee2e2;
  color: #991b1b;
}
.backup-uri {
  display: inline-block;
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.backup-row-muted td {
  color: #6b7280;
  background: #fafafa;
}

.maintenance-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.maintenance-admin-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.maintenance-service-name {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}
.maintenance-service-host {
  font-size: 11px;
  color: #6b7280;
  margin-top: 3px;
}
.maintenance-admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.maintenance-state {
  min-width: 78px;
  font-size: 12px;
  font-weight: 600;
  color: #059669;
  text-align: right;
}
.maintenance-state.is-on {
  color: #dc2626;
}
.maintenance-switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}
.maintenance-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.maintenance-switch span {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1d5db;
  border-radius: 999px;
  transition: background 0.15s;
}
.maintenance-switch span::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.15s;
}
.maintenance-switch input:checked + span {
  background: #dc2626;
}
.maintenance-switch input:checked + span::before {
  transform: translateX(18px);
}

/* 集計パネル */
.analytics-panel {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: none;
}
.analytics-panel.active { display: block; }
.analytics-panel.analytics-full-bleed {
  padding: 0;
  overflow: hidden;
}
.rakuten-sales-panel {
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.rakuten-sales-section {
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  margin-bottom: 0;
}
.analytics-sub-tab-bar {
  display: none !important;
}
.analytics-sub-tab-btn {
  padding: 5px 12px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  color: #6b7280;
  border-radius: 14px;
  transition: all 0.15s;
}
.analytics-sub-tab-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  font-weight: 600;
}

/* データパネル */
.data-panel {
  flex: 1;
  overflow-y: auto;
  display: none;
}
.data-panel.active { display: block; }
.data-sub-tab-bar {
  display: none !important;
}
.data-sub-tab-btn {
  padding: 5px 12px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  color: #6b7280;
  border-radius: 14px;
  transition: all 0.15s;
}
.data-sub-tab-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  font-weight: 600;
}
.data-sub-panel { display: none; }
.data-sub-panel.active { display: block; }
.mat-inner-tab-btn {
  padding: 3px 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 11px;
  cursor: pointer;
  color: #6b7280;
  border-radius: 10px;
  transition: all 0.15s;
}
.mat-inner-tab-btn.active {
  background: #1d4ed8;
  color: #fff;
  border-color: #1d4ed8;
  font-weight: 600;
}
.data-platform-tab-btn {
  padding: 3px 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 11px;
  cursor: pointer;
  color: #6b7280;
  border-radius: 10px;
  transition: all 0.15s;
}
.data-platform-tab-btn.active {
  background: #1d4ed8;
  color: #fff;
  border-color: #1d4ed8;
  font-weight: 600;
}
.data-platform-panel { display: none; }
.data-platform-panel.active { display: block; }

.boss-order-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.boss-order-table th, .boss-order-table td {
  border: 1px solid #e5e7eb;
  padding: 4px 6px;
  white-space: nowrap;
}
.boss-order-table th {
  background: #f3f4f6;
  color: #374151;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}
.boss-order-table tr:hover { background: #f0f9ff; }
.boss-order-table .order-link {
  color: #2563eb;
  cursor: pointer;
  text-decoration: underline;
}
.boss-order-table .order-link:hover { color: #1d4ed8; }
.boss-order-table .rakuten-item-link {
  color: #2563eb;
  cursor: pointer;
  text-decoration: underline;
}
.boss-order-table .rakuten-item-link:hover { color: #1d4ed8; }

.order-detail-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.order-detail-items-table th, .order-detail-items-table td {
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
}
.order-detail-items-table th {
  background: #f3f4f6;
  font-weight: 600;
  text-align: left;
}

.donation-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.donation-table th, .donation-table td {
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
  text-align: right;
  white-space: nowrap;
}
.donation-table th {
  background: #f3f4f6;
  color: #374151;
  font-weight: 600;
  position: sticky;
  top: 0;
}
.donation-table th:first-child, .donation-table td:first-child {
  text-align: left;
}
.donation-table tr:hover { background: #f9fafb; }
.donation-table tfoot td {
  font-weight: 700;
  background: #eef2ff;
  border-top: 2px solid #6366f1;
}

/* アカウント管理 */
.account-list { margin-bottom: 12px; }
.acct-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.acct-table thead th {
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
  padding: 6px 8px;
  text-align: center;
  font-weight: 600;
  color: #374151;
  font-size: 11px;
  white-space: nowrap;
}
.acct-table thead th:first-child { text-align: left; }
.acct-table tbody td {
  border-bottom: 1px solid #f3f4f6;
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
}
.acct-table tbody tr:hover { background: #f9fafb; }
.acct-table tbody tr.account-inactive { opacity: 0.45; }
.acct-name-cell { text-align: left !important; white-space: nowrap; }
.acct-name-cell .account-name { font-weight: 600; color: #111827; font-size: 12px; }
.acct-name-cell .account-username { font-size: 10px; color: #9ca3af; margin-left: 4px; }
.account-role-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.account-role-admin { background: #fef3c7; color: #92400e; }
.account-role-staff { background: #dbeafe; color: #1e40af; }
.acct-perm-dot {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  width: 20px;
  text-align: center;
}
.acct-perm-dot.on { color: #16a34a; }
.acct-perm-dot.off { color: #d1d5db; }
.acct-perm-dot.partial { color: #f59e0b; font-size: 10px; }
.acct-actions-cell { white-space: nowrap; }
.account-edit-btn, .account-toggle-btn {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  color: #374151;
}
.account-edit-btn:hover { background: #f3f4f6; }
.account-toggle-btn.deactivate { border-color: #fca5a5; color: #dc2626; }
.account-toggle-btn.activate { border-color: #6ee7b7; color: #059669; }
/* アカウント編集フォーム */
.account-form-card {
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px;
  background: #eff6ff;
  margin-bottom: 12px;
}
.account-form-card h4 { font-size: 13px; margin: 0 0 10px; color: #1e40af; }
.account-form-row { display: flex; gap: 8px; margin-bottom: 8px; }
.account-form-row input, .account-form-row select {
  flex: 1;
  padding: 7px 8px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #fff;
  color: #374151;
  min-width: 0;
}
.account-form-row input:focus, .account-form-row select:focus {
  outline: none;
  border-color: #2563eb;
}
.perm-matrix { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 8px; }
.perm-matrix label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #374151;
  cursor: pointer;
}
.account-form-actions { display: flex; gap: 8px; }
.account-save-btn {
  flex: 1;
  padding: 7px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.account-save-btn:hover { background: #1d4ed8; }
.account-cancel-btn {
  padding: 7px 14px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  color: #374151;
}
.account-cancel-btn:hover { background: #f3f4f6; }
.account-form-status { font-size: 11px; margin-top: 4px; min-height: 14px; }

/* アカウント作成モーダル */
.account-modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.account-modal-overlay.visible { display: flex; }
.account-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}
.account-modal h3 {
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #2563eb;
}
.account-modal .account-form-row { margin-bottom: 10px; }
.account-modal .account-form-actions { margin-top: 16px; }

/* ネスト型権限マトリクス */
.perm-tree { margin-bottom: 8px; }
.perm-tree-item { margin-bottom: 2px; }
.perm-tree-parent {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #1f2937;
  cursor: pointer;
  padding: 4px 0;
}
.perm-tree-parent input[type="checkbox"] { cursor: pointer; }
.perm-tree-children {
  margin-left: 22px;
  padding-left: 8px;
  border-left: 2px solid #e5e7eb;
}
.perm-tree-child {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #4b5563;
  cursor: pointer;
  padding: 2px 0;
}
.perm-tree-child input[type="checkbox"] { cursor: pointer; }

/* 新規作成ボタン */
.account-create-trigger {
  padding: 6px 14px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.account-create-trigger:hover { background: #1d4ed8; }

/* 需要予測テーブル */
.forecast-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
  white-space: nowrap;
}
.forecast-table th, .forecast-table td {
  padding: 4px 6px;
  border: 1px solid #e5e7eb;
  text-align: right;
}
/* 固定コントロールバー */
.forecast-control-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 10px;
  background: #334155;
  min-height: 36px;
  box-sizing: border-box;
}
.forecast-bar-input {
  width: 180px;
  padding: 4px 8px;
  border: 1px solid #475569;
  border-radius: 4px;
  font-size: 12px;
  background: #334155;
  color: #f1f5f9;
}
.forecast-bar-input::placeholder { color: #94a3b8; }
.forecast-bar-btn {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
}
.forecast-bar-btn-primary { background: #3b82f6; color: #fff; }
.forecast-bar-btn-green { background: #059669; color: #fff; }
.forecast-bar-btn-amber { background: #f59e0b; color: #fff; }
.forecast-bar-btn-purple { background: #7c3aed; color: #fff; }
.forecast-bar-btn-light { background: #475569; color: #e2e8f0; }
.forecast-bar-btn:disabled { opacity: 0.5; cursor: default; }
.forecast-bar-select {
  padding: 3px 4px;
  border: 1px solid #475569;
  border-radius: 3px;
  font-size: 11px;
  background: #334155;
  color: #f1f5f9;
}
.forecast-bar-bulk-group {
  display: flex; align-items: center; gap: 4px; font-size: 11px; color: #94a3b8;
}
.forecast-bar-input-sm {
  width: 55px; padding: 3px 4px; font-size: 11px; text-align: center;
  background: #1e293b; color: #e2e8f0; border: 1px solid #475569; border-radius: 4px;
}
.forecast-bar-input-sm:focus { border-color: #60a5fa; outline: none; }
.forecast-bar-bulk-lt { color: #94a3b8; margin-left: 2px; }
.forecast-bar-check {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #cbd5e1;
  cursor: pointer;
  white-space: nowrap;
}
.forecast-bar-sep {
  width: 1px;
  height: 20px;
  background: #475569;
  margin: 0 2px;
}
.forecast-row-updating { opacity: 0.35; pointer-events: none; transition: opacity 0.2s; }

.forecast-table th {
  background: #f3f4f6;
  font-weight: 600;
  color: #374151;
  position: sticky;
  top: 64px;
  z-index: 8;
}
.forecast-table th:first-child,
.forecast-table td:first-child {
  width: 24px;
  padding: 2px 4px;
  text-align: center;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
}
.forecast-table th:first-child {
  background: #f3f4f6;
  z-index: 9;
}
.forecast-table td:nth-child(2),
.forecast-table th:nth-child(2) {
  text-align: left;
  position: sticky;
  left: 34px;
  background: #fff;
  z-index: 1;
}
.forecast-table th:nth-child(2) {
  background: #f3f4f6;
  z-index: 9;
}
#skuSettingsTable {
  table-layout: fixed;
}
#skuSettingsTable td:nth-child(1),
#skuSettingsTable th:nth-child(1),
#skuSettingsTable td:nth-child(2),
#skuSettingsTable th:nth-child(2) {
  position: static;
  left: auto;
  z-index: auto;
}
#setSkuSettingsTable th {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #f3f4f6;
}
#setSkuSettingsTable th:first-child,
#setSkuSettingsTable th:nth-child(2) {
  position: sticky;
  top: 0;
  left: auto;
  z-index: 6;
  background: #f3f4f6;
}
#setSkuSettingsTable td:first-child,
#setSkuSettingsTable td:nth-child(2) {
  position: static;
  left: auto;
  z-index: auto;
  background: inherit;
}
.delivery-history-row:hover, .delivery-list-row:hover { background: #f0f9ff; }
.forecast-table tbody tr:hover { background: #f9fafb; }
.forecast-table tbody tr:hover td:first-child,
.forecast-table tbody tr:hover td:nth-child(2) { background: #f9fafb; }
.forecast-order-moq-boosted { background: #fffbeb !important; color: #b45309; font-weight: 600; }
.forecast-order-zero { color: #9ca3af; }
.forecast-stockout { color: #dc2626; font-size: 10px; }
.forecast-block-cell { cursor: pointer; }
.forecast-order-moq-excluded { background: #f9fafb !important; color: #9ca3af; }
.moq-forced-qty { font-size: 10px; color: #6b7280; margin-left: 1px; }
.moq-toggle { font-size: 10px; color: #6b7280; cursor: pointer; white-space: nowrap; margin-left: 4px; }
.moq-toggle input { vertical-align: middle; margin: 0 2px 0 0; cursor: pointer; }
/* 在庫持続バーチャート */
.forecast-duration-cell { text-align: left !important; padding: 2px 4px !important; }
.duration-chart {
  position: relative; height: 20px; width: 300px; min-width: 300px;
  background: #fafafa; border: 1px solid #e5e7eb; border-radius: 2px;
  overflow: hidden;
}
.duration-bar {
  position: absolute; top: 0; left: 0; height: 100%; border-radius: 1px;
  min-width: 0;
}
.duration-bar-stock { background: #3b82f6; z-index: 3; height: 6px; top: 1px; }
.duration-bar-pending { background: #93c5fd; z-index: 2; height: 6px; top: 7px; }
.duration-bar-order { background: #dbeafe; z-index: 1; height: 6px; top: 13px; }
.duration-scale-line {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: #d1d5db; z-index: 4; pointer-events: none;
}
.duration-scale-label {
  position: absolute; top: -1px; font-size: 7px; color: #9ca3af;
  transform: translateX(-50%); z-index: 5; pointer-events: none;
  line-height: 1;
}
.duration-lt-marker {
  position: absolute; bottom: 0; z-index: 6;
  color: #dc2626; font-size: 8px; line-height: 1;
  transform: translateX(-50%);
  pointer-events: auto; cursor: default;
}
/* 列選択ドロップダウン */
.forecast-col-dropdown {
  z-index: 10000;
  background: #fff; border: 1px solid #d1d5db; border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.12); padding: 8px 0;
  min-width: 160px; font-size: 12px; display: none;
}
.forecast-col-dropdown.open { display: block; }
.forecast-col-dropdown label {
  display: flex; align-items: center; gap: 6px; padding: 4px 12px; cursor: pointer;
  white-space: nowrap;
}
.forecast-col-dropdown label:hover { background: #f3f4f6; }
.forecast-col-dropdown label.required { color: #9ca3af; cursor: default; }
.forecast-col-dropdown input { margin: 0; cursor: pointer; }

.forecast-col-dropdown input:disabled { cursor: default; }

/* 需要予測アクションバー */
.forecast-action-bar {
  position: fixed; bottom: 0; left: 180px; right: 0;
  background: #1e293b; color: #e2e8f0;
  z-index: 9999; box-shadow: 0 -2px 12px rgba(0,0,0,0.25);
}
.fab-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 10px 20px;
  display: flex; align-items: center; gap: 16px;
  font-size: 12px;
}
.fab-count { font-weight: 700; color: #60a5fa; white-space: nowrap; }
.fab-divider { width: 1px; height: 20px; background: #475569; }
.fab-group { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.fab-group label { color: #94a3b8; font-weight: 500; }
.fab-group input[type="number"] {
  width: 52px; text-align: center; background: #334155; color: #f1f5f9;
  border: 1px solid #475569; border-radius: 4px; padding: 3px 4px; font-size: 12px;
}
.fab-group input[type="number"]:focus { border-color: #60a5fa; outline: none; }
.fab-btn-primary {
  background: #2563eb; color: #fff; border: none; border-radius: 4px;
  padding: 4px 12px; font-size: 11px; font-weight: 600; cursor: pointer;
}
.fab-btn-primary:hover { background: #1d4ed8; }
.fab-btn-ghost {
  background: transparent; color: #94a3b8; border: 1px solid #475569;
  border-radius: 4px; padding: 4px 10px; font-size: 11px; cursor: pointer;
}
.fab-btn-ghost:hover { color: #e2e8f0; border-color: #64748b; }
.forecast-sku-check, .forecast-select-all {
  cursor: pointer; margin: 0;
}

.forecast-outlier-badge {
  font-size: 9px; color: #d97706; margin-left: 2px;
  vertical-align: super; line-height: 1;
}
#forecastTooltip {
  display: none; position: fixed; z-index: 9999;
  background: #fff; border: 1px solid #d1d5db; border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15); padding: 6px 8px;
  min-width: 260px; max-width: 360px; white-space: nowrap;
  max-height: 50vh; overflow-y: auto;
}
.forecast-tooltip-table table {
  width: 100%; border-collapse: collapse; font-size: 11px;
}
.forecast-tooltip-table th {
  background: #f3f4f6; padding: 3px 6px; text-align: left;
  font-weight: 600; border-bottom: 1px solid #e5e7eb;
  position: static;
}
.forecast-tooltip-table td {
  padding: 3px 6px; border-bottom: 1px solid #f3f4f6;
}
.forecast-tooltip-table a {
  color: #2563eb; text-decoration: none;
}
.forecast-tooltip-table a:hover { text-decoration: underline; }
.forecast-outlier-row { background: #fffbeb; }
.forecast-outlier-qty { color: #d97706; font-weight: 600; }
.forecast-product-header {
  margin: 0;
  padding: 6px 8px;
  background: #eef2ff;
  border-radius: 0;
  font-size: 12px;
  font-weight: 600;
  color: #3730a3;
  line-height: 16px;
  box-sizing: border-box;
  height: 28px;
  display: flex; align-items: center; gap: 8px;
  position: sticky; top: 36px; z-index: 10;
}
.forecast-product-toggle { display: flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 400; color: #6b7280; cursor: pointer; white-space: nowrap; }
.demand-basis-group { display: inline-flex; border: 1px solid #d1d5db; border-radius: 4px; overflow: hidden; margin-left: 8px; }
.demand-basis-btn { padding: 1px 8px; font-size: 10px; font-weight: 500; border: none; cursor: pointer; background: #fff; color: #6b7280; transition: all 0.15s; line-height: 16px; }
.demand-basis-btn.active { background: #2563eb; color: #fff; }
.demand-basis-btn:not(.active):hover { background: #f3f4f6; }
.forecast-product-toggle input[type="checkbox"] { margin: 0; cursor: pointer; }
.forecast-product-toggle input[type="checkbox"]:checked + span,
.forecast-product-toggle:has(input:checked) { color: #059669; }
.forecast-actual-qty { border: 1px solid #d1d5db; border-radius: 3px; }
.forecast-actual-qty:disabled { background: #f3f4f6; color: #9ca3af; }
.po-step2-section { margin-bottom: 12px; }
.po-step2-section h4 { margin: 0 0 6px; font-size: 12px; color: #374151; }
.po-step2-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.po-step2-table th, .po-step2-table td { padding: 4px 6px; border: 1px solid #e5e7eb; text-align: right; white-space: nowrap; }
.po-step2-table th { background: #f3f4f6; font-weight: 600; text-align: center; }
.po-step2-table td:first-child { text-align: left; }
.po-step2-table input[type="number"] { width: 60px; text-align: right; font-size: 11px; padding: 1px 4px; border: 1px solid #d1d5db; border-radius: 3px; }
.po-step2-empty { color: #9ca3af; font-style: italic; padding: 8px 0; }
.po-step2-sku-summary { margin-bottom: 12px; padding: 8px 10px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; font-size: 12px; }
.inv-matrix { width: 100%; border-collapse: collapse; font-size: 11px; }
.inv-matrix th, .inv-matrix td { padding: 3px 5px; border: 1px solid #e5e7eb; text-align: right; white-space: nowrap; }
.inv-matrix th { background: #f3f4f6; font-weight: 600; color: #374151; position: sticky; top: 0; z-index: 1; }
.inv-matrix td:first-child, .inv-matrix th:first-child { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; min-width: 90px; }
.inv-matrix th:first-child { background: #f3f4f6; z-index: 2; }
.inv-matrix tbody tr:hover { background: #f9fafb; }
.inv-matrix tbody tr:hover td:first-child { background: #f9fafb; }
.inv-zero { color: #dc2626; font-weight: 600; }
.inv-low { color: #d97706; }
.inv-null { color: #d1d5db; }

/* 作業パネル */
.product-edit-panel {
  display: none;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
}
.product-edit-panel.active { display: flex; }
.work-sub-tab-bar {
  display: none !important;
}
.work-sub-tab-btn {
  padding: 5px 12px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  color: #6b7280;
  border-radius: 14px;
  transition: all 0.15s;
}
.work-sub-tab-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  font-weight: 600;
}
.work-sub-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}
.work-sub-panel.active { display: flex; }
#workMercariInvPanel:not(.active) { display: none !important; }
#workAccountingPanel.active { flex-direction: column; }
.order-sub-tab-bar {
  display: none !important;
}
.order-sub-tab-btn {
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 11px;
  cursor: pointer;
  color: #6b7280;
  border-radius: 12px;
  transition: all 0.15s;
}
.order-sub-tab-btn.active {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
  font-weight: 600;
}
.order-sub-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: auto;
}
.order-sub-panel.active { display: flex; }
.ordering-sub-tab-btn {
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 11px;
  cursor: pointer;
  color: #6b7280;
  border-radius: 12px;
  transition: all 0.15s;
}
.ordering-sub-tab-btn.active {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
  font-weight: 600;
}
.ordering-sub-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}
.ordering-sub-panel.active { display: flex; }
.pe-search-form { margin-bottom: 12px; }
.pe-form-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.pe-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
}
.pe-input:focus { outline: none; border-color: #2563eb; }
.pe-select {
  padding: 7px 6px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  background: white;
}
.pe-search-btn {
  padding: 7px 14px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.pe-search-btn:hover { background: #1d4ed8; }
.pe-search-btn:disabled { background: #93c5fd; cursor: not-allowed; }
.pe-status { font-size: 12px; color: #6b7280; margin-top: 6px; min-height: 16px; }
.pe-results { flex: 1; }

/* Shopify画像カルーセル */
.shopify-carousel {
  margin-top: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  background: #fafafa;
}
.shopify-carousel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: #6b7280;
}
.shopify-carousel-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}
.shopify-carousel-track::-webkit-scrollbar { height: 4px; }
.shopify-carousel-track::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }
.shopify-carousel-item {
  flex: 0 0 auto;
  width: 120px;
  scroll-snap-align: start;
  position: relative;
  border: 2px solid transparent;
  border-radius: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.shopify-carousel-item:hover { border-color: #93c5fd; }
.shopify-carousel-item.drag-over {
  border-color: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
  background: #fffbeb;
}
.shopify-carousel-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}
.shopify-carousel-item .position-badge {
  position: absolute;
  top: 4px; left: 4px;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
}
.shopify-carousel-item .alt-text {
  font-size: 10px;
  color: #6b7280;
  text-align: center;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 画像差し替え確認ダイアログ */
.image-replace-dialog {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.image-replace-content {
  background: white;
  border-radius: 12px;
  padding: 20px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.image-replace-comparison { display: flex; gap: 12px; margin: 12px 0; }
.image-replace-side { flex: 1; text-align: center; }
.image-replace-side img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}
.image-replace-side .label { font-size: 11px; color: #6b7280; margin-top: 4px; }
.image-replace-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.image-replace-actions button {
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #d1d5db;
}
.image-replace-actions .confirm-btn { background: #2563eb; color: white; border: none; }
.image-replace-actions .confirm-btn:disabled { background: #93c5fd; cursor: not-allowed; }
.image-replace-actions .cancel-btn { background: white; }
.image-replace-actions .cancel-btn:hover { background: #f3f4f6; }
.moq-product-card:hover { background: #f0f0f0; }

/* --- Judge.me レビュー投入 --- */
.judgeme-sub-panel { display:none; }
.judgeme-sub-panel.active { display:block; }
.judgeme-stats-cards { display:grid; grid-template-columns:repeat(auto-fill, minmax(120px, 1fr)); gap:8px; margin-bottom:12px; }
.judgeme-stat-card { background:#f9fafb; border:1px solid #e5e7eb; border-radius:6px; padding:10px; text-align:center; }
.judgeme-stat-card.posted { border-left:3px solid #22c55e; }
.judgeme-stat-card.pending { border-left:3px solid #3b82f6; }
.judgeme-stat-card.lowrate { border-left:3px solid #f59e0b; }
.judgeme-stat-card.failed { border-left:3px solid #ef4444; }
.judgeme-stat-value { font-size:20px; font-weight:700; color:#1f2937; }
.judgeme-stat-label { font-size:11px; color:#6b7280; }
.judgeme-table { width:100%; border-collapse:collapse; font-size:12px; }
.judgeme-table th { background:#f9fafb; padding:6px 8px; text-align:left; border-bottom:1px solid #e5e7eb; font-weight:600; color:#374151; white-space:nowrap; }
.judgeme-table td { padding:5px 8px; border-bottom:1px solid #f3f4f6; color:#374151; }
.judgeme-table tr:hover { background:#f9fafb; }
.judgeme-status-badge { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:500; }
.judgeme-status-badge.posted { background:#dcfce7; color:#16a34a; }
.judgeme-status-badge.failed { background:#fef2f2; color:#dc2626; }
.judgeme-status-badge.lowrate { background:#fef9c3; color:#ca8a04; }
.judgeme-action-btn { padding:6px 14px; font-size:12px; border:1px solid #d1d5db; border-radius:4px; background:#fff; cursor:pointer; }
.judgeme-action-btn:hover { background:#f3f4f6; }
.judgeme-action-btn.post { background:#3b82f6; color:#fff; border-color:#3b82f6; }
.judgeme-action-btn.post:hover { background:#2563eb; }
.judgeme-page-btn { padding:4px 10px; font-size:12px; border:1px solid #d1d5db; border-radius:4px; background:#fff; cursor:pointer; }
.judgeme-page-btn:hover { background:#f3f4f6; }
.judgeme-review-card { border:1px solid #e5e7eb; padding:12px; margin:8px 0; border-radius:6px; background:#fff; }
.judgeme-review-card:hover { border-color:#d1d5db; }
.judgeme-approve-btn { padding:4px 12px; font-size:12px; border:none; border-radius:4px; background:#22c55e; color:#fff; cursor:pointer; }
.judgeme-approve-btn:hover { background:#16a34a; }
.judgeme-reject-btn { padding:4px 12px; font-size:12px; border:none; border-radius:4px; background:#ef4444; color:#fff; cursor:pointer; }
.judgeme-reject-btn:hover { background:#dc2626; }
/* キュー: ヘッダー固定 */
.judgeme-queue-header { position:sticky; top:0; z-index:10; background:#fff; padding-bottom:4px; }
.judgeme-queue-filters { display:flex; gap:8px; margin-bottom:8px; flex-wrap:wrap; align-items:center; }
.judgeme-queue-scroll { max-height:calc(100vh - 220px); overflow-y:auto; }
.judgeme-queue-scroll .judgeme-table thead th { position:sticky; top:0; z-index:5; background:#f9fafb; border-bottom:2px solid #e5e7eb; }
/* ストアバッジ */
.judgeme-store-badge { display:inline-block; padding:1px 6px; border-radius:8px; font-size:10px; font-weight:500; margin-right:2px; background:#f3f4f6; color:#6b7280; }
.judgeme-store-badge.posted { background:#dcfce7; color:#16a34a; }
.judgeme-store-badge.pending { background:#dbeafe; color:#2563eb; }
.judgeme-store-badge.failed { background:#fef2f2; color:#dc2626; }
/* 低評価: 購入履歴 */
.judgeme-lr-history { margin-top:8px; padding:8px; background:#f9fafb; border-radius:4px; border:1px solid #e5e7eb; }

/* === QAレビュー === */
.qa-review-card { border:1px solid #e5e7eb; border-radius:8px; padding:16px; margin-bottom:12px; background:#fff; }
.qa-review-header { font-size:13px; margin-bottom:8px; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.qa-score-badge { display:inline-block; padding:1px 8px; border-radius:10px; font-size:12px; font-weight:600; }
.qa-score-high { background:#dcfce7; color:#16a34a; }
.qa-score-mid { background:#fef9c3; color:#a16207; }
.qa-score-low { background:#fef2f2; color:#dc2626; }
.qa-status-badge { display:inline-block; padding:1px 8px; border-radius:10px; font-size:11px; font-weight:500; }
.qa-badge-pending { background:#fef9c3; color:#a16207; }
.qa-badge-approved { background:#dcfce7; color:#16a34a; }
.qa-badge-needs-improvement { background:#fef2f2; color:#dc2626; }
.qa-score-breakdown { display:flex; gap:10px; margin-bottom:10px; flex-wrap:wrap; }
.qa-breakdown-item { flex:1; min-width:120px; }
.qa-breakdown-label { font-size:11px; color:#6b7280; display:block; margin-bottom:2px; }
.qa-breakdown-bar { height:6px; background:#e5e7eb; border-radius:3px; overflow:hidden; }
.qa-breakdown-fill { height:100%; background:#3b82f6; border-radius:3px; transition:width 0.3s; }
.qa-prompt-changes { font-size:12px; color:#4b5563; background:#f0fdf4; border:1px solid #bbf7d0; border-radius:4px; padding:6px 10px; margin-bottom:10px; }
.qa-section-toggle { cursor:pointer; font-size:12px; color:#374151; padding:4px 0; user-select:none; }
.qa-section-toggle:hover { color:#1d4ed8; }
.qa-toggle-arrow { display:inline-block; width:14px; font-size:10px; }
.qa-section-content { font-size:12px; color:#374151; padding:6px 0; line-height:1.6; }
.qa-compare-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:10px 0; }
.qa-compare-col { border:1px solid #e5e7eb; border-radius:6px; padding:10px; background:#fafafa; }
.qa-compare-title { font-size:11px; font-weight:600; color:#6b7280; margin-bottom:6px; text-transform:uppercase; letter-spacing:0.5px; }
.qa-compare-body { font-size:12px; color:#374151; white-space:pre-wrap; line-height:1.6; max-height:300px; overflow-y:auto; }
.qa-reviewer-comment { font-size:12px; color:#374151; background:#fef3c7; border:1px solid #fde68a; border-radius:4px; padding:8px 10px; margin-top:8px; }
.qa-review-actions { margin-top:10px; }
.qa-comment-input { width:100%; padding:6px 8px; font-size:12px; border:1px solid #d1d5db; border-radius:4px; resize:vertical; font-family:inherit; }
.qa-btn { padding:5px 16px; font-size:12px; font-weight:500; border:none; border-radius:4px; cursor:pointer; transition:background 0.15s; }
.qa-btn-approve { background:#16a34a; color:#fff; }
.qa-btn-approve:hover { background:#15803d; }
.qa-btn-reject { background:#dc2626; color:#fff; }
.qa-btn-reject:hover { background:#b91c1c; }

/* === ギフティング管理 === */
.gifting-sub-tab-btn { padding:4px 12px; border:1px solid #d1d5db; background:#fff; font-size:11px; cursor:pointer; color:#6b7280; border-radius:12px; transition:all 0.15s; }
.gifting-sub-tab-btn.active { background:#4f46e5; color:#fff; border-color:#4f46e5; font-weight:600; }
.gifting-view-btn { padding:3px 10px; border:1px solid #d1d5db; background:#fff; font-size:10px; cursor:pointer; color:#6b7280; border-radius:4px; }
.gifting-view-btn.active { background:#374151; color:#fff; border-color:#374151; }
.gifting-toolbar { flex-shrink:0; padding-top:8px; padding-bottom:8px; }

.gifting-table { border-collapse:separate; border-spacing:0; width:100%; font-size:11px; }
.gifting-table thead { background:#f3f4f6; }
.gifting-table th, .gifting-table td { padding:6px 8px; border:1px solid #e5e7eb; text-align:left; border-top:none; border-left:none; }
.gifting-table th:first-child, .gifting-table td:first-child { border-left:1px solid #e5e7eb; }
.gifting-table thead tr:first-child th { border-top:1px solid #e5e7eb; }
.gifting-table th { font-weight:600; color:#374151; font-size:10px; white-space:nowrap; position:sticky; top:0; z-index:3; background:#f3f4f6; }
.gifting-table tbody tr:hover { background:#f9fafb; }
/* 展開中キャンペーン行のsticky */
.camp-row-sticky td { position:sticky; top:28px; z-index:2; background:#fff; }
/* アコーディオン内テーブルヘッダー（stickyを無効化して通常配置） */
.camp-detail-row .gifting-table th { position:static; }
.gifting-notes-input { width:100%; border:none; background:transparent; font-size:11px; padding:2px 4px; outline:none; }
.gifting-notes-input:focus { background:#eff6ff; border-radius:2px; }

/* カンバン */
.gifting-kanban { display:flex; gap:8px; overflow-x:auto; flex:1; min-height:0; }
.gifting-kanban-col { flex:0 0 180px; background:#f9fafb; border-radius:8px; padding:6px; display:flex; flex-direction:column; min-height:0; }
.gifting-kanban-header { font-size:11px; font-weight:600; padding:4px 6px 6px; margin-bottom:6px; border-bottom:2px solid #d1d5db; flex-shrink:0; }
.gifting-kanban-cards { flex:1; overflow-y:auto; min-height:0; }
#giftingInfluencerPanel { flex:1; display:flex; flex-direction:column; min-height:0; }
#giftingInfluencerKanban { flex:1; display:flex; flex-direction:column; min-height:0; }
.gifting-kanban-card { position:relative; background:#fff; border:1px solid #e5e7eb; border-radius:6px; padding:8px; margin-bottom:6px; cursor:pointer; transition:box-shadow 0.15s; }
.gifting-kanban-card:hover { box-shadow:0 2px 8px rgba(0,0,0,0.08); }
.gifting-card-btn { margin-top:6px; padding:2px 8px; font-size:10px; background:#4f46e5; color:#fff; border:none; border-radius:4px; cursor:pointer; }
.gifting-card-btn:hover { background:#4338ca; }
.gifting-status-revert-btn { position:absolute; top:6px; right:6px; width:22px; height:22px; border-radius:50%; background:#e5e7eb; border:none; cursor:pointer; font-size:12px; line-height:22px; text-align:center; color:#6b7280; padding:0; }
.gifting-status-revert-btn:hover { background:#d1d5db; color:#374151; }

/* スライドインパネル */
.gifting-slide-panel { position:fixed; top:0; right:-400px; width:380px; height:100vh; background:#fff; box-shadow:-4px 0 16px rgba(0,0,0,0.1); transition:right 0.25s ease; z-index:1000; overflow-y:auto; }
.gifting-slide-panel.open { right:0; }

/* モーダル */
.gifting-modal-overlay { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.3); display:flex; align-items:center; justify-content:center; z-index:1100; }
.gifting-modal { background:#fff; border-radius:12px; padding:20px; width:90%; max-width:360px; box-shadow:0 8px 32px rgba(0,0,0,0.15); }

/* ステータスバッジ */
.gifting-status-badge { padding:2px 8px; border-radius:10px; font-size:10px; font-weight:600; white-space:nowrap; }
.gifting-status-candidate { background:#f3f4f6; color:#6b7280; }
.gifting-status-attack { background:#fef3c7; color:#92400e; }
.gifting-status-interested { background:#cffafe; color:#0e7490; }
.gifting-status-application { background:#dbeafe; color:#1e40af; }
.gifting-status-shipping { background:#ede9fe; color:#5b21b6; }
.gifting-status-shipped { background:#d1fae5; color:#065f46; }
.gifting-status-completed { background:#a7f3d0; color:#047857; }
.gifting-status-stories-done { background:#bae6fd; color:#0369a1; }
.gifting-status-material-done { background:#ddd6fe; color:#5b21b6; }

/* 列設定モーダル */
.col-setting-item { display:flex; align-items:center; gap:8px; padding:8px 10px; border:1px solid #e5e7eb; border-radius:6px; margin-bottom:4px; background:#fff; cursor:grab; }
.col-setting-item:active { cursor:grabbing; }
.col-drag-handle { color:#9ca3af; font-size:14px; cursor:grab; }

/* ==========================================================
   🌱 プラント育成ゲーム — レトロゲーム機風デザイン
   自社システムから完全分離したスコープ付きスタイル
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* --- ゲーム機フレーム --- */
.plant-game-frame {
  max-width: 450px;
  margin: 16px auto 0;
  background: linear-gradient(145deg, #c8c0b8, #a8a098);
  border-radius: 20px 20px 60px 60px;
  padding: 16px 16px 32px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.3),
    inset 0 2px 0 rgba(255,255,255,0.3),
    inset 0 -2px 0 rgba(0,0,0,0.2);
  font-family: 'Press Start 2P', monospace;
  position: relative;
  image-rendering: pixelated;
  transform-origin: top center;
}

.plant-game-frame * {
  font-family: 'Press Start 2P', monospace;
}

/* --- ヘッダー --- */
.plant-game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px 12px;
}

.plant-game-logo {
  font-size: 9px;
  color: #4B4845;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

.plant-game-close {
  font-size: 16px;
  color: #8B8580;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.15s;
}

.plant-game-close:hover {
  background: rgba(0,0,0,0.1);
  color: #4B4845;
  transform: scale(1.2);
}

/* --- スクリーン（液晶画面） --- */
.plant-game-screen {
  background: #9bbc0f;
  border-radius: 12px;
  border: 6px solid #4B4845;
  box-shadow:
    inset 0 0 30px rgba(0,0,0,0.15),
    inset 0 0 6px rgba(0,0,0,0.3),
    0 3px 6px rgba(0,0,0,0.2);
  height: 280px;
  position: relative;
  overflow: hidden;
  image-rendering: pixelated;
}

/* 背景: 空 */
.plant-game-sky {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60%;
  background: linear-gradient(180deg, #8BAC0F 0%, #9BBC0F 100%);
}

/* 雲 */
.plant-game-cloud {
  position: absolute;
  width: 42px; height: 14px;
  background: rgba(255,255,255,0.5);
  border-radius: 7px;
  box-shadow:
    -14px 4px 0 8px rgba(255,255,255,0.35),
    14px 4px 0 8px rgba(255,255,255,0.35);
  z-index: 2;
}

.plant-game-cloud-1 {
  top: 50px; left: -80px;
  animation: plantCloudMove1 20s linear infinite;
}

.plant-game-cloud-2 {
  top: 100px; left: -80px;
  animation: plantCloudMove2 28s linear infinite;
}

@keyframes plantCloudMove1 {
  0% { transform: translateX(-80px); }
  100% { transform: translateX(calc(100% + 700px)); }
}

@keyframes plantCloudMove2 {
  0% { transform: translateX(700px); }
  100% { transform: translateX(-180px); }
}

/* --- ピクセルアート --- */
.plant-game-art-area {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

.plant-game-pixel {
  width: 1px; height: 1px;
  position: relative;
  transition: box-shadow 0.5s ease, filter 0.5s ease;
}

/* バウンスアニメーション（水やり時） */
.plant-game-bounce {
  animation: plantBounce 0.5s ease;
}

@keyframes plantBounce {
  0% { transform: translateY(0); }
  20% { transform: translateY(-8px) scaleY(1.1); }
  40% { transform: translateY(0) scaleY(0.9); }
  60% { transform: translateY(-4px); }
  80% { transform: translateY(0) scaleY(0.95); }
  100% { transform: translateY(0) scaleY(1); }
}

/* しおれ状態 */
.plant-game-wilted .plant-game-screen {
  background: #7a8a0a;
  filter: saturate(0.4) brightness(0.85);
}

.plant-game-wilted .plant-game-pixel {
  filter: grayscale(0.6) brightness(0.7);
  transform: skewX(-5deg);
}

.plant-game-wilted-text {
  color: #5a4a00;
  font-size: 18px;
  animation: plantWiltPulse 1.5s ease-in-out infinite;
}

@keyframes plantWiltPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- ステータスオーバーレイ --- */
.plant-game-status-overlay {
  position: absolute;
  top: 12px; left: 16px; right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  color: #306230;
  z-index: 10;
}

.plant-game-streak {
  font-size: 16px;
  animation: plantStreakGlow 1s ease-in-out infinite alternate;
}

@keyframes plantStreakGlow {
  0% { color: #306230; }
  100% { color: #0F380F; text-shadow: 0 0 4px rgba(15,56,15,0.5); }
}

/* --- セリフ吹き出し --- */
.plant-game-speech {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, 60px);
  z-index: 10;
  background: rgba(15,56,15,0.15);
  color: #0F380F;
  font-size: 16px;
  padding: 8px 18px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 10;
  animation: plantSpeechPop 0.4s ease;
}

@keyframes plantSpeechPop {
  0% { transform: translate(-50%, 60px) scale(0); opacity: 0; }
  60% { transform: translate(-50%, 60px) scale(1.1); }
  100% { transform: translate(-50%, 60px) scale(1); opacity: 1; }
}

/* --- 虹エフェクト --- */
.plant-game-rainbow {
  position: absolute;
  top: 20px; left: 60px;
  width: 160px; height: 80px;
  border-radius: 160px 160px 0 0;
  border: 3px solid transparent;
  border-top-color: rgba(255,0,0,0.3);
  box-shadow:
    0 -3px 0 rgba(255,127,0,0.25),
    0 -6px 0 rgba(255,255,0,0.2),
    0 -9px 0 rgba(0,200,0,0.2),
    0 -12px 0 rgba(0,0,255,0.15),
    0 -15px 0 rgba(75,0,130,0.1);
  animation: plantRainbowIn 1s ease forwards;
  z-index: 5;
}

@keyframes plantRainbowIn {
  0% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0.7; transform: scale(1); }
}

/* --- コントロールパネル --- */
.plant-game-controls {
  padding: 20px 8px 8px;
}

/* ゲージ */
.plant-game-gauges {
  margin-bottom: 8px;
}

.plant-game-gauge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.plant-game-gauge-label {
  font-size: 11px;
  color: #4B4845;
  width: 90px;
  flex-shrink: 0;
}

.plant-game-gauge-bar {
  flex: 1;
  height: 14px;
  background: #D5CFC5;
  border-radius: 3px;
  border: 2px solid #8B8580;
  overflow: hidden;
  image-rendering: pixelated;
}

.plant-game-gauge-fill {
  height: 100%;
  transition: width 0.6s ease;
  image-rendering: pixelated;
  /* ピクセル風ステップ表現 */
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.1) 3px,
    rgba(0,0,0,0.1) 4px
  );
}

.plant-game-gauge-val {
  font-size: 11px;
  color: #4B4845;
  width: 80px;
  text-align: right;
  flex-shrink: 0;
}

.plant-game-gauge-val.plant-game-max {
  color: #D97706;
  width: auto;
  animation: plantMaxPulse 2s ease-in-out infinite;
}

@keyframes plantMaxPulse {
  0%, 100% { color: #D97706; }
  50% { color: #F472B6; text-shadow: 0 0 4px rgba(244,114,182,0.3); }
}

/* --- ボタン --- */
.plant-game-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.plant-game-btn {
  flex: 1;
  font-size: 18px;
  padding: 6px 8px;
  border: 3px solid #4B4845;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  line-height: 1.6;
  transition: all 0.1s;
  box-shadow:
    0 3px 0 #4B4845,
    0 4px 4px rgba(0,0,0,0.2);
  position: relative;
  top: 0;
}

.plant-game-btn:active:not([disabled]) {
  top: 3px;
  box-shadow: 0 0 0 #4B4845;
  transform: scale(0.97);
}

.plant-game-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.plant-game-btn-water {
  background: linear-gradient(180deg, #7DD3FC, #38BDF8);
  color: #0C4A6E;
}

.plant-game-btn-water:hover:not([disabled]) {
  background: linear-gradient(180deg, #BAE6FD, #7DD3FC);
}

.plant-game-btn-feed {
  background: linear-gradient(180deg, #86EFAC, #22C55E);
  color: #14532D;
}

.plant-game-btn-feed:hover:not([disabled]) {
  background: linear-gradient(180deg, #BBF7D0, #86EFAC);
}

.plant-game-btn-cost {
  font-size: 14px;
  opacity: 0.7;
}

/* --- フィード（下部情報） --- */
.plant-game-feed {
  font-size: 16px;
  color: #6B6560;
  text-align: center;
  padding: 8px 0;
  border-top: 1px dashed #C5BFB5;
}

/* --- ゲーム機下部装飾 --- */
.plant-game-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 30px 0;
}

/* 十字キー */
.plant-game-dpad {
  position: relative;
  width: 50px; height: 50px;
}

.plant-game-dpad-v, .plant-game-dpad-h {
  position: absolute;
  background: #4B4845;
  border-radius: 3px;
}

.plant-game-dpad-v {
  width: 16px; height: 50px;
  left: 17px; top: 0;
}

.plant-game-dpad-h {
  width: 50px; height: 16px;
  left: 0; top: 17px;
}

/* A/Bボタン */
.plant-game-ab {
  display: flex;
  gap: 16px;
  align-items: center;
  transform: rotate(-15deg);
}

.plant-game-btn-a, .plant-game-btn-b {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #8B3060;
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 #5A2040, inset 0 -2px 3px rgba(0,0,0,0.2);
}

.plant-game-btn-b {
  margin-top: 10px;
}

/* --- アニメーション --- */

/* スライドイン */
.plant-game-slide-in {
  animation: plantSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes plantSlideIn {
  0% { transform: translateY(40px) scale(0.8); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* スライドアウト */
.plant-game-slide-out {
  animation: plantSlideOut 0.4s ease forwards;
}

@keyframes plantSlideOut {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(40px) scale(0.8); opacity: 0; }
}

/* 起動フラッシュ */
.plant-game-boot-flash {
  position: absolute;
  inset: 0;
  background: #9bbc0f;
  z-index: 50;
  animation: plantBootFlash 0.8s ease forwards;
}

@keyframes plantBootFlash {
  0% { opacity: 1; background: #E8F5E9; }
  30% { opacity: 1; background: #C8E6C9; }
  60% { opacity: 0.5; }
  100% { opacity: 0; }
}

/* 白フラッシュ（レベルアップ） */
.plant-game-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 40;
  animation: plantFlash 0.6s ease forwards;
}

@keyframes plantFlash {
  0% { opacity: 1; }
  30% { opacity: 0.8; }
  100% { opacity: 0; }
}

/* レベルアップテキスト */
.plant-game-levelup {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  color: #0F380F;
  text-align: center;
  line-height: 2;
  z-index: 45;
  text-shadow: 0 0 8px rgba(155,188,15,0.8);
  animation: plantLevelUp 2.5s ease forwards;
}

@keyframes plantLevelUp {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  15% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* パーティクル */
@keyframes plantParticleFly {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

/* 水滴 */
@keyframes plantWaterFall {
  0% { opacity: 0; transform: translateY(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(50px); }
}

/* フローティングテキスト */
@keyframes plantFloatUp {
  0% { opacity: 0; transform: translate(-50%, 0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -30px); }
}

/* --- 情報オーバーレイ --- */
.plant-game-info-overlay {
  position: absolute;
  inset: 0;
  background: rgba(75, 72, 69, 0.85);
  border-radius: 20px 20px 60px 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.plant-game-info-box {
  background: #F5F0E8;
  border: 4px solid #4B4845;
  border-radius: 12px;
  padding: 24px;
  width: 70%;
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.plant-game-info-title {
  font-size: 22px;
  color: #4B4845;
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 3px dashed #C5BFB5;
}

.plant-game-info-row {
  font-size: 16px;
  color: #4B4845;
  padding: 10px 0;
  border-bottom: 1px dotted #D5CFC5;
}

.plant-game-btn-close-info {
  margin-top: 18px;
  width: 100%;
  font-size: 18px;
  padding: 14px;
  background: linear-gradient(180deg, #D5CFC5, #C5BFB5);
  color: #4B4845;
  border: 2px solid #4B4845;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 2px 0 #4B4845;
}

.plant-game-btn-close-info:active {
  box-shadow: none;
  transform: translateY(2px);
}

/* フェードイン/アウト */
@keyframes plantFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes plantFadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* === システムAGT === */
.sagt-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #e2e8f0; flex-wrap: wrap; }
.sagt-tabs { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.sagt-tab { padding: 4px 10px; border: none; background: none; cursor: pointer; font-size: 11px; color: #64748b; border-radius: 4px; }
.sagt-tab:hover { background: #f1f5f9; }
.sagt-tab.active { background: #3b82f6; color: #fff; }
.sagt-tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px; margin-left: 3px; border-radius: 8px; font-size: 10px; font-weight: 600; background: #e2e8f0; color: #475569; line-height: 1; }
.sagt-tab.active .sagt-tab-count { background: rgba(255,255,255,0.3); color: #fff; }
.sagt-new-btn { padding: 6px 14px; background: #3b82f6; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.sagt-new-btn:hover { background: #2563eb; }

.sagt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sagt-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid #e2e8f0; color: #64748b; font-size: 11px; font-weight: 600; }
.sagt-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; }
.sagt-row { cursor: pointer; }
.sagt-row:hover { background: #f8fafc; }
.sagt-list-cancel-btn { padding: 4px 10px; border: 1px solid #fecaca; border-radius: 6px; background: #fff; color: #dc2626; cursor: pointer; font-size: 12px; white-space: nowrap; }
.sagt-list-cancel-btn:hover { background: #fef2f2; }
.sagt-list-cancel-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.sagt-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; color: #fff; font-size: 11px; font-weight: 600; }

/* フォーム */
.sagt-form-wrap { max-width: 1000px; margin: 0 auto; padding: 20px; }
.sagt-form-title { margin: 0 0 16px; font-size: 16px; color: #1e293b; }
.sagt-form-group { margin-bottom: 16px; }
.sagt-form-group label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: #374151; }
.sagt-required { color: #ef4444; }
.sagt-form-group input[type="text"], .sagt-form-group textarea { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; box-sizing: border-box; }
.sagt-form-group textarea { resize: vertical; }
.sagt-form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.sagt-submit-btn { padding: 8px 20px; background: #3b82f6; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
.sagt-submit-btn:hover { background: #2563eb; }
.sagt-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.sagt-cancel-btn { padding: 8px 20px; background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; border-radius: 6px; cursor: pointer; font-size: 13px; }
.sagt-cancel-btn:hover { background: #e2e8f0; }
.sagt-danger-btn { padding: 8px 20px; background: #ef4444; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
.sagt-danger-btn:hover { background: #dc2626; }

/* スクショ */
.sagt-screenshots { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.sagt-screenshot-item { position: relative; width: 100px; height: 100px; }
.sagt-screenshot-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; border: 1px solid #e2e8f0; cursor: pointer; }
.sagt-screenshot-remove { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: #ef4444; color: #fff; border: none; cursor: pointer; font-size: 12px; line-height: 20px; padding: 0; }
.sagt-paste-hint { margin-bottom: 8px; padding: 10px 12px; border: 1px dashed #94a3b8; border-radius: 6px; background: #f8fafc; color: #64748b; font-size: 12px; cursor: text; outline: none; }
.sagt-paste-hint:focus { border-color: #3b82f6; background: #eff6ff; color: #1d4ed8; }
.sagt-upload-btn { display: inline-block; padding: 6px 14px; background: #f1f5f9; border: 1px dashed #94a3b8; border-radius: 6px; cursor: pointer; font-size: 12px; color: #64748b; }
.sagt-upload-btn:hover { background: #e2e8f0; }

/* 画像拡大 */
.sagt-image-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 10000; cursor: pointer; }
.sagt-image-overlay img { max-width: 90vw; max-height: 90vh; border-radius: 8px; }
.sagt-image-close { position: absolute; top: 20px; right: 20px; background: none; border: none; color: #fff; font-size: 32px; cursor: pointer; }

/* 詳細ビュー */
#aiSystemAgt { overflow-y: auto !important; }
.sagt-detail { padding: 12px; }
.sagt-detail-header { margin-bottom: 16px; }
.sagt-back-btn { background: none; border: none; color: #3b82f6; cursor: pointer; font-size: 13px; padding: 4px 0; margin-bottom: 8px; }
.sagt-back-btn:hover { text-decoration: underline; }
.sagt-detail-title-row { display: flex; align-items: center; gap: 8px; }
.sagt-detail-id { color: #94a3b8; font-size: 14px; font-weight: 600; }
.sagt-detail-title { margin: 0; font-size: 16px; color: #1e293b; flex: 1; }
.sagt-detail-meta { color: #94a3b8; font-size: 12px; margin-top: 4px; }
.sagt-detail-section { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #f1f5f9; }
.sagt-detail-section h4 { margin: 0 0 8px; font-size: 13px; color: #64748b; }
.sagt-detail-desc { font-size: 13px; color: #1e293b; line-height: 1.6; }
.sagt-detail-screenshots { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sagt-screenshot-thumb { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid #e2e8f0; cursor: pointer; }
.sagt-screenshot-thumb:hover { opacity: 0.8; }

/* メッセージ */
.sagt-messages { max-height: 400px; overflow-y: auto; padding: 4px 0; }
.sagt-msg { margin-bottom: 8px; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.sagt-msg-agent { background: #eff6ff; border-left: 3px solid #3b82f6; }
.sagt-msg-user { background: #f0fdf4; border-left: 3px solid #10b981; }
.sagt-msg-status { background: #f8fafc; text-align: center; color: #94a3b8; font-size: 11px; border: none; }
.sagt-msg-plan { background: #faf5ff; border-left: 3px solid #8b5cf6; }
.sagt-msg-sender { font-weight: 600; font-size: 12px; color: #64748b; margin-bottom: 4px; }
.sagt-msg-content { color: #1e293b; line-height: 1.5; }
.sagt-msg-time { color: #94a3b8; font-size: 10px; margin-top: 4px; }
.sagt-msg-empty { color: #94a3b8; font-size: 12px; text-align: center; padding: 20px; }

/* アクション */
.sagt-actions { padding: 12px 0; }
.sagt-reply-area { display: flex; flex-direction: column; gap: 8px; }
.sagt-reply-area textarea { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; box-sizing: border-box; resize: vertical; }
.sagt-plan-actions { text-align: center; }
.sagt-plan-note { margin-bottom: 8px; font-size: 13px; color: #64748b; }
.sagt-plan-actions button { margin: 0 4px; }
.sagt-admin-actions { display: flex; flex-direction: column; gap: 8px; }
.sagt-admin-actions textarea { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; box-sizing: border-box; resize: vertical; }
.sagt-admin-btns { display: flex; gap: 8px; }
.sagt-cancel-request { margin-top: 12px; font-size: 12px; padding: 6px 12px; }

.sagt-header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.sagt-heartbeat-badge { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap; border: 1px solid #e2e8f0; background: #f8fafc; color: #64748b; }
.sagt-heartbeat-badge.active { border-color: #bbf7d0; background: #f0fdf4; color: #15803d; }
.sagt-heartbeat-badge.inactive { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }

/* ============================================================ */
/* ヒアリングUI（タブ形式）                                      */
/* ============================================================ */
.tl-hearing-container { background: #fefce8; border: 1px solid #fde68a; border-radius: 12px; padding: 16px; max-width: 100%; }
.tl-hearing-container.redefine { background: #fff7ed; border-color: #fed7aa; }
.tl-hearing-container.research { background: #eff6ff; border-color: #bfdbfe; }
.tl-hearing-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.tl-hearing-icon { font-size: 16px; }
.tl-hearing-title { font-size: 13px; font-weight: 600; color: #92400e; }
.tl-hearing-container.redefine .tl-hearing-title { color: #9a3412; }
.tl-hearing-container.research .tl-hearing-title { color: #1e40af; }
.tl-hearing-badge { background: #fbbf24; color: #78350f; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.tl-hearing-container.redefine .tl-hearing-badge { background: #fb923c; color: #7c2d12; }
.tl-hearing-container.research .tl-hearing-badge { background: #60a5fa; color: #1e3a5f; }

/* タブ */
.tl-hearing-tabs { display: flex; gap: 0; margin-bottom: 0; }
.tl-hearing-tab { padding: 6px 16px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid #fde68a; border-bottom: none; border-radius: 8px 8px 0 0; background: #fffbeb; color: #92400e; transition: all 0.15s; user-select: none; }
.tl-hearing-tab.active { background: #fff; color: #1e293b; border-bottom-color: #fff; position: relative; z-index: 1; }
.tl-hearing-tab.answered { color: #15803d; }
.tl-hearing-tab.answered::after { content: " ✓"; }
.tl-hearing-container.redefine .tl-hearing-tab { border-color: #fed7aa; background: #fff7ed; color: #9a3412; }
.tl-hearing-container.research .tl-hearing-tab { border-color: #bfdbfe; background: #eff6ff; color: #1e40af; }
.tl-hearing-container.redefine .tl-hearing-tab.active,
.tl-hearing-container.research .tl-hearing-tab.active { background: #fff; color: #1e293b; }

/* タブ内容 */
.tl-hearing-body { border: 1px solid #fde68a; border-radius: 0 8px 8px 8px; background: #fff; padding: 14px; margin-bottom: 12px; }
.tl-hearing-container.redefine .tl-hearing-body { border-color: #fed7aa; }
.tl-hearing-container.research .tl-hearing-body { border-color: #bfdbfe; }
.tl-hearing-body[style*="display: none"] { display: none; }
.tl-hearing-q-text { font-size: 13px; color: #1e293b; font-weight: 500; line-height: 1.5; margin-bottom: 6px; }
.tl-hearing-reason { font-size: 11px; color: #92400e; margin-bottom: 12px; font-style: italic; }
.tl-hearing-container.redefine .tl-hearing-reason { color: #9a3412; }
.tl-hearing-container.research .tl-hearing-reason { color: #1e40af; }

/* 候補選択 */
.tl-hearing-candidates { display: flex; flex-direction: column; gap: 6px; }
.tl-hearing-candidate { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; cursor: pointer; transition: all 0.15s; font-size: 13px; color: #1e293b; }
.tl-hearing-candidate:hover { background: #fef3c7; border-color: #f59e0b; }
.tl-hearing-candidate input[type="radio"] { accent-color: #f59e0b; flex-shrink: 0; }
.tl-hearing-candidate.custom { background: #f8fafc; border-color: #e2e8f0; color: #64748b; }
.tl-hearing-container.redefine .tl-hearing-candidate { background: #fff7ed; border-color: #fed7aa; }
.tl-hearing-container.redefine .tl-hearing-candidate:hover { background: #ffedd5; border-color: #fb923c; }
.tl-hearing-container.research .tl-hearing-candidate { background: #eff6ff; border-color: #bfdbfe; }
.tl-hearing-container.research .tl-hearing-candidate:hover { background: #dbeafe; border-color: #60a5fa; }
.tl-hearing-custom-input { width: 100%; margin-top: 6px; padding: 8px 10px; font-size: 13px; border: 1px solid #e2e8f0; border-radius: 6px; resize: vertical; min-height: 40px; font-family: inherit; box-sizing: border-box; }
.tl-hearing-custom-input:focus { outline: none; border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1); }

/* アクションボタン */
.tl-hearing-actions { display: flex; gap: 8px; justify-content: flex-end; }
.tl-hearing-reverse-btn { padding: 6px 14px; font-size: 12px; color: #64748b; background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; cursor: pointer; transition: all 0.15s; }
.tl-hearing-reverse-btn:hover { background: #f1f5f9; }
.tl-hearing-submit-btn { padding: 6px 14px; font-size: 12px; color: #fff; background: #f59e0b; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; transition: all 0.15s; }
.tl-hearing-submit-btn:hover { background: #d97706; }
.tl-hearing-submit-btn:disabled { background: #fcd34d; cursor: not-allowed; }

/* モデル選択プルダウン */
.model-select-wrapper { display: inline-flex; align-items: center; gap: 4px; }
.model-select-wrapper select { font-size: 11px; padding: 2px 6px; border: 1px solid #e2e8f0; border-radius: 4px; background: #fff; color: #64748b; cursor: pointer; }
.model-version-badge { font-size: 9px; padding: 1px 5px; border-radius: 3px; font-weight: 600; }
.model-version-badge.v1 { background: #f1f5f9; color: #64748b; }
.model-version-badge.v2 { background: #dbeafe; color: #1e40af; }
.model-version-badge.v3 { background: #dcfce7; color: #166534; }
.model-version-badge.v4 { background: #fae8ff; color: #86198f; }

/* 旧STEP2セット最適化UI（フェーズ2で削除予定） */
#poFlowStep2 { display: none !important; }

/* セット最適化サマリー */
.setopt-summary {
  display: flex; align-items: center; gap: 10px; padding: 4px 12px;
  background: #f5f3ff; border-bottom: 1px solid #e5e7eb; font-size: 11px;
}
.setopt-badge {
  background: #7c3aed; color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 3px;
}
.setopt-rec { font-weight: 600; color: #5b21b6; }
.setopt-cost { color: #374151; }
.setopt-surplus { color: #6b7280; }
.setopt-savings { color: #059669; font-weight: 600; }
.setopt-compare-btn, .setopt-detail-btn {
  background: #ede9fe; color: #7c3aed; border: 1px solid #c4b5fd;
  border-radius: 3px; padding: 1px 8px; font-size: 10px; cursor: pointer; font-weight: 500;
}
.setopt-compare-btn:hover, .setopt-detail-btn:hover { background: #ddd6fe; }

/* 比較ポップオーバー */
.setopt-compare-popover {
  position: fixed; z-index: 10002;
  background: #1e293b; color: #e2e8f0; border-radius: 8px;
  padding: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  min-width: 300px;
}
.setopt-model-card {
  padding: 8px 12px; border-radius: 6px; cursor: pointer;
  display: grid; grid-template-columns: 140px 70px 70px 50px 50px;
  align-items: center; gap: 4px; margin-bottom: 2px;
}
.setopt-model-card:hover { background: #334155; }
.setopt-model-card.selected { background: #1e3a5f; border: 1px solid #3b82f6; }
.setopt-model-name { font-weight: 600; font-size: 12px; }
.setopt-model-cost { font-size: 11px; color: #94a3b8; text-align: right; }
.setopt-model-surplus { font-size: 11px; color: #94a3b8; text-align: right; }
.setopt-model-saving { color: #34d399; font-size: 11px; text-align: right; }
.setopt-model-check { color: #60a5fa; font-size: 10px; font-weight: 600; text-align: right; }

/* 内訳パネル */
.setopt-detail-panel { background: #faf5ff; border-bottom: 1px solid #e5e7eb; }
.setopt-detail-inner { padding: 8px 16px; display: flex; gap: 16px; overflow-x: auto; }
.setopt-design-group { min-width: 280px; }
.setopt-design-label { font-weight: 600; font-size: 11px; color: #7c3aed; margin-bottom: 4px; }
.setopt-detail-table { border-collapse: collapse; font-size: 10px; width: 100%; }
.setopt-detail-table th { background: #ede9fe; padding: 2px 4px; border: 1px solid #ddd6fe; text-align: center; font-weight: 500; }
.setopt-detail-table td { padding: 2px 4px; border: 1px solid #e5e7eb; text-align: center; }

/* === 商品開発タブ === */
.pd-skill-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.pd-slide-viewer { background: #f9fafb; border-radius: 8px; padding: 16px; }
.pd-slide { transition: opacity 0.2s ease; }
.pd-dot { transition: background 0.2s ease; }
.pd-dot:hover { background: #93c5fd !important; }

/* === NECTO Design System Components === */
.btn {
  padding: 5px 14px;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--text-inverse);
}

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

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

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

.btn-danger {
  background: var(--color-danger);
  color: var(--text-inverse);
}

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

.btn-success {
  background: var(--color-success-dark);
  color: var(--text-inverse);
}

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

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

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

.btn-xs {
  padding: 2px 8px;
  font-size: var(--font-size-sm);
}

.btn-sm {
  padding: 4px 10px;
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: 7px 18px;
  font-size: var(--font-size-md);
}

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

.input,
.select,
.textarea {
  padding: 6px 10px;
  font-size: var(--font-size-base);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  background: var(--bg-input);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
  outline: none;
}

.input-sm,
.select-sm {
  padding: 4px 8px;
  font-size: var(--font-size-sm);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
}

.textarea {
  resize: vertical;
  min-height: 80px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  height: var(--toolbar-height);
  flex-shrink: 0;
}

.toolbar-spacer { flex: 1; }

.toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border-default);
}

.table-container {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
}

.table-scroll {
  flex: 1;
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-base);
  table-layout: fixed;
}

.table th {
  padding: 5px 10px;
  text-align: center;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-muted);
  font-weight: var(--font-weight-semibold);
  position: sticky;
  top: 0;
  z-index: 10;
}

.table td {
  padding: 5px 10px;
  text-align: center;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-light);
}

.table tbody tr:hover { background: var(--color-primary-bg); }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-top: 1px solid var(--border-default);
  font-size: var(--font-size-sm);
}

.page-btn {
  min-width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  background: transparent;
  cursor: pointer;
}

.page-btn.active {
  background: var(--color-primary);
  color: var(--text-inverse);
}

.page-btn:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-tight);
}

.badge-success {
  background: var(--color-success-subtle);
  color: var(--color-success-text);
}

.badge-danger {
  background: var(--color-danger-subtle);
  color: var(--color-danger-text);
}

.badge-warning {
  background: var(--color-warning-subtle);
  color: var(--color-warning-text);
}

.badge-info {
  background: var(--color-info-subtle);
  color: var(--color-info);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chip.active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-bg);
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-size-md);
}

.loading-state {
  padding: 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--font-size-md);
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: var(--z-modal-backdrop);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  width: 92%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-muted);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-default);
}

.sess-inspector-modal {
  max-width: 1100px;
  width: 94%;
}

.sess-inspector-title {
  margin: 0;
  font-size: var(--font-size-lg);
  color: var(--text-primary);
}

.sess-inspector-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.sess-inspector-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.sess-inspector-main {
  min-width: 0;
}

.sess-inspector-row-head,
.sess-inspector-meta,
.sess-inspector-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.sess-inspector-row-head {
  margin-bottom: var(--space-2);
}

.sess-inspector-agt {
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.sess-inspector-room,
.sess-inspector-meta,
.sess-inspector-activity,
.sess-inspector-trigger {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.sess-inspector-activity,
.sess-inspector-trigger {
  overflow-wrap: anywhere;
}

.sess-inspector-trigger {
  margin-top: var(--space-1);
  color: var(--text-tertiary);
}

.sess-inspector-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.sess-inspector-badge.danger {
  background: var(--color-danger-subtle);
  color: var(--color-danger-text);
}

.sess-inspector-badge.muted {
  background: var(--bg-muted);
  color: var(--text-tertiary);
}

.sess-inspector-actions {
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .sess-inspector-row {
    grid-template-columns: 1fr;
  }

  .sess-inspector-actions {
    justify-content: flex-start;
  }
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.cell-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.cell-text.truncated { cursor: pointer; }

.shell-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-3);
  border: none;
  background: transparent;
  color: var(--text-inverse);
  font-size: var(--font-size-2xl);
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 190;
}

.u-flex { display: flex; }
.u-gap-1 { gap: var(--space-1); }
.u-gap-2 { gap: var(--space-2); }
.u-gap-3 { gap: var(--space-3); }
.u-text-right { text-align: right; }
.u-text-left { text-align: left; }
.u-text-center { text-align: center; }
.u-muted { color: var(--text-muted); }
.u-hidden { display: none !important; }

@media (max-width:768px) {
  /* シェル: サイドバーをドロワー化 */
  .shell-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mode-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-sidebar {
    position: fixed;
    top: var(--shell-top, 42px);
    left: 0;
    height: calc(100vh - var(--shell-top, 42px));
    width: 280px;
    max-width: 85vw;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 200;
    box-shadow: var(--shadow-lg, 0 4px 24px rgba(0,0,0,0.2));
  }

  .app-sidebar.open {
    transform: none;
  }

  .app-sidebar.collapsed {
    width: 280px;
  }

  .app-sidebar.collapsed .app-sidebar-nav {
    display: block;
  }

  .sidebar-toggle-btn {
    display: none;
  }

  .sidebar-backdrop.open {
    display: block;
  }

  .agent-toolbar {
    flex-wrap: wrap;
    height: auto;
    row-gap: var(--space-1);
    justify-content: flex-start;
  }

  .agent-dropdown-menu {
    min-width: 0;
    width: calc(100vw - 24px);
    right: 0;
    left: auto;
  }

  .ai-input-area {
    padding: var(--space-2);
    gap: var(--space-1);
  }

  .ai-input-area textarea {
    min-width: 0;
  }

  .ai-input-area button {
    width: 40px;
    height: 40px;
  }

  .tl-table {
    display: block;
    overflow-x: auto;
  }

  .tl-user .tl-bubble {
    max-width: 88%;
  }

  .tl-assistant .tl-content {
    max-width: 92%;
  }
}
