:root {
  --yellow: #ffd400;
  --yellow-strong: #e5a500;
  --bg: #fffdf5;
  --text: #111111;
  --muted: #555555;
  --border: #e5d27a;
  --panel: #fffaea;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.header {
  background: var(--yellow);
  padding: 12px 24px;
  border-bottom: 3px solid var(--yellow-strong);
  display: flex;
  align-items: baseline;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.header h1 {
  margin: 0;
  font-size: 20px;
}

.header .tag {
  background: #111;
  color: var(--yellow);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
}
.header .tag.tag-verify {
  background: #b91c1c;
  color: #fff;
}

/* 検証用テナントのパネル (variant=verify のみ表示) */
.verify-panel {
  border: 2px dashed #b91c1c;
  background: #fff7ed;
}

/* 汎用 LLM モード (verify variant) の結果表示 */
.result-a-general {
  white-space: pre-wrap;
  line-height: 1.6;
  padding: 12px 14px;
  background: #f8fafc;
  border-left: 4px solid #b91c1c;
  border-radius: 4px;
  margin: 12px 0;
}
.result-cond {
  font-size: 12px;
  color: #64748b;
  margin: 4px 0 8px 0;
}
.sub-views {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.sub-view {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 10px;
  background: #ffffff;
}
.sub-view summary {
  cursor: pointer;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}
.sub-view summary .persona-desc {
  margin-left: 8px;
  font-weight: 400;
  font-size: 12px;
}
.sub-view-body {
  margin-top: 8px;
  white-space: pre-wrap;
  font-size: 13px;
  color: #334155;
  line-height: 1.55;
}
.verify-panel .verify-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.verify-panel .verify-lbl {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: #333;
  gap: 4px;
}
.verify-panel .verify-lbl select {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  min-width: 240px;
  background: #fff;
}

/* ========================================================================
 * sales_support テナント用スタイル
 * ======================================================================== */

.header .tag.tag-sales {
  background: #1d4ed8;
  color: #ffffff;
}

.header .tag.tag-gemma {
  background: #7c3aed;
  color: #ffffff;
}

.sales-panel {
  border: 2px dashed #1d4ed8;
  background: #eff6ff;
}

.sales-mode-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.sales-mode-lbl {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}
.sales-mode-lbl:hover {
  background: #dbeafe;
}
.sales-mode-lbl small {
  color: #64748b;
  font-size: 12px;
}

.sales-axis-row,
.sales-status-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.sales-axis-row label,
.sales-status-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}

.sales-reps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.sales-reps-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #ffffff;
}
.sales-reps-col-label {
  font-weight: 600;
  font-size: 13px;
  color: #1e3a8a;
  margin-bottom: 4px;
}
.sales-reps-col label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 6px;
}

.result-sales .sales-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 13px;
}
.result-sales .sales-table th,
.result-sales .sales-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
.result-sales .sales-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 600;
}
.result-sales .link-btn {
  background: none;
  border: 1px solid #1d4ed8;
  color: #1d4ed8;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.result-sales .link-btn:hover {
  background: #1d4ed8;
  color: #fff;
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.badge-open { background: #2563eb; }
.badge-hold { background: #a16207; }
.badge-won { background: #16a34a; }
.badge-lost { background: #dc2626; }
.badge-call { background: #7c3aed; }
.badge-email { background: #0891b2; }
.badge-meeting { background: #db2777; }

.deal-summary {
  white-space: pre-wrap;
  line-height: 1.6;
  color: #1e293b;
  background: #f8fafc;
  border-left: 3px solid #1d4ed8;
  padding: 8px 12px;
  border-radius: 4px;
  margin-top: 4px;
  font-size: 13px;
}

.sales-selected-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sales-selected {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  background: #ffffff;
}
.sales-selected .link-row {
  margin-top: 6px;
}
.sales-deals-inline {
  list-style: none;
  padding: 6px 0 0 0;
  margin: 8px 0 4px 0;
  border-top: 1px dashed #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #334155;
}
.sales-deals-inline li {
  line-height: 1.55;
  padding-left: 4px;
  border-left: 2px solid #e2e8f0;
  padding-inline-start: 8px;
}

.sales-activities {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.sales-activity {
  border-left: 3px solid #cbd5e1;
  padding: 6px 10px;
}
.sales-activity-head {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #475569;
}
.sales-activity-body {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.5;
}
.sales-activity-summary {
  margin-top: 4px;
  font-size: 12px;
  font-style: italic;
}

.header .caution {
  margin: 0;
  font-size: 12px;
  color: #333;
}

.main {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.sidebar section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}

.sidebar h2 {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar label {
  display: block;
  font-size: 14px;
  margin: 4px 0;
  cursor: pointer;
}

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

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

#question {
  flex: 1;
  border: 2px solid var(--yellow-strong);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  background: #fff;
  resize: vertical;
}

#submit {
  background: var(--yellow);
  border: 2px solid var(--yellow-strong);
  border-radius: 8px;
  padding: 0 20px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

#submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status {
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

.answer-card {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 6px solid var(--yellow);
  border-radius: 8px;
  padding: 16px 20px;
}

.answer-card h2 {
  margin-top: 0;
  font-size: 16px;
}

.answer-card h3 {
  font-size: 13px;
  color: var(--muted);
  margin: 16px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.answer {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 15px;
}

.intent {
  background: var(--panel);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
}

.sources, .candidates {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sources li, .candidates li {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  background: var(--panel);
  font-size: 13px;
}

.sources .cid, .candidates .cid {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--yellow-strong);
  font-weight: 700;
  margin-right: 6px;
}

/* 候補ナレッジ一覧のうち、LLM が採用したチャンク (selected_chunk_id 一致) を
   緑チェックで強調する。IP コアの allowlist に selected_chunk_id は含まれるので
   このハイライトによる追加漏洩リスクはない。 */
.sources li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sources li.selected {
  border-color: #16a34a;          /* green-600 */
  background: #f0fdf4;            /* green-50 */
  box-shadow: 0 0 0 1px #86efac inset; /* green-300 */
}
.sources li.selected .cid {
  color: #166534;                 /* green-800 */
}
.sources .cid-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  min-width: 18px;
  font-size: 14px;
  line-height: 1;
}
.sources .cid-check.placeholder {
  /* 未採用チャンクでも縦位置を揃えるためのプレースホルダ (視覚的には空) */
  opacity: 0;
}

/* ── サブエージェント詳細テーブル (HOD 社内検証テナントのみ表示) ── */
.debug-detail {
  margin-top: 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fbfbff;
}
.debug-detail > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #4338ca; /* indigo-700: 社内検証用であることを視覚的に区別 */
}
.debug-intent {
  margin: 8px 0 4px;
  font-size: 13px;
  padding: 6px 10px;
  background: var(--panel);
  border-radius: 6px;
}
.debug-table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}
.debug-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.debug-table th,
.debug-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
.debug-table thead th {
  background: #eef2ff; /* indigo-50 */
  white-space: nowrap;
}
.debug-table tr.sub-match td {
  background: #f0fdf4; /* green-50: 合致したサブを強調 */
}
.debug-table tr.sub-nomatch td {
  color: #6b7280;
}
.debug-table td.sub-flag {
  white-space: nowrap;
  font-weight: 700;
}
.debug-table td.sub-cands code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.debug-table td.sub-cands code.selected {
  color: #166534;
  font-weight: 700;
}
.debug-table td.sub-reason {
  min-width: 220px;
}

.meta, .raw {
  font-size: 12px;
  background: #fafafa;
  padding: 8px;
  border-radius: 6px;
  overflow-x: auto;
}

details {
  margin-top: 10px;
}

details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

/* --- ヘッダー挨拶 --- */
.greeting {
  font-size: 14px;
  font-weight: 700;
  color: #111;
  background: rgba(255, 255, 255, 0.6);
  padding: 4px 12px;
  border-radius: 999px;
}

/* --- Admin / 入力フォーム --- */
.header-link {
  margin-left: auto;
  font-size: 13px;
  color: #111;
  text-decoration: none;
  border: 2px solid var(--yellow-strong);
  border-radius: 6px;
  padding: 4px 10px;
  background: #fff;
}

.header-link:hover {
  background: var(--yellow);
}

/* --- チェックシート --- */
/* 表を広く、検索パネルを右に固定幅。狭い画面では縦積み。 */
.checksheet-main {
  grid-template-columns: minmax(0, 1fr) 340px;
}

@media (max-width: 900px) {
  .checksheet-main {
    grid-template-columns: 1fr;
  }
}

.kb-open-btn {
  width: 100%;
  background: var(--yellow);
  border: 2px solid var(--yellow-strong);
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.checksheet-intro {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.6;
}

.check-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.check-table th,
.check-table td {
  border: 1px solid var(--border);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.check-table thead th {
  background: var(--yellow);
  font-size: 13px;
  letter-spacing: 0.03em;
}

.check-table th.check-col,
.check-table td.check-col {
  width: 120px;
  text-align: center;
  vertical-align: middle;
}

.check-table tbody tr:nth-child(odd) td {
  background: var(--panel);
}

.check-table tbody tr.missing td {
  background: #fdecea;
}

.check-table tbody tr.missing td.item-col {
  color: #c0392b;
}

.check-table input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--yellow-strong);
}

.check-cat {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--yellow-strong);
  margin-bottom: 4px;
}

.check-item-text {
  font-weight: 700;
}

.check-item-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.checksheet-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 16px;
}

.check-progress {
  font-size: 13px;
  color: var(--muted);
}

.check-progress.complete {
  color: #1e7e34;
  font-weight: 700;
}

#checksheet-submit {
  background: var(--yellow);
  border: 2px solid var(--yellow-strong);
  border-radius: 8px;
  padding: 10px 28px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

#checksheet-submit:disabled {
  background: #e0e0e0;
  border-color: #cccccc;
  color: #999999;
  cursor: not-allowed;
}

.checksheet-done {
  background: #e6f4ea;
  border: 1px solid #1e7e34;
  color: #1e7e34;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  margin-top: 12px;
}

/* チェックシート右側のナレッジ検索パネル */
.kb-search-panel {
  position: sticky;
  top: 16px;
}

.kb-search-panel .ask-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kb-search-panel textarea {
  width: 100%;
  border: 2px solid var(--yellow-strong);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  background: #fff;
  resize: vertical;
  font-family: inherit;
}

.kb-search-panel button {
  background: var(--yellow);
  border: 2px solid var(--yellow-strong);
  border-radius: 8px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.kb-search-panel button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.kb-answer {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 14px;
  margin-top: 10px;
}

.form-card {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 6px solid var(--yellow);
  border-radius: 8px;
  padding: 16px 20px;
}

.form-card h2 {
  margin-top: 0;
  font-size: 16px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.field-hint {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.req {
  font-style: normal;
  font-size: 11px;
  background: #c0392b;
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.opt {
  font-style: normal;
  font-size: 11px;
  background: #eee;
  color: #555;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.field input[type="text"],
.field textarea {
  width: 100%;
  border: 2px solid var(--yellow-strong);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
  resize: vertical;
  font-family: inherit;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.form-actions button,
.kb-actions button {
  background: var(--yellow);
  border: 2px solid var(--yellow-strong);
  border-radius: 8px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.form-actions .ghost,
.kb-actions button {
  background: #fff;
  font-weight: 500;
  padding: 6px 12px;
  font-size: 13px;
}

.kb-actions button.danger,
.danger {
  border-color: #c0392b;
  color: #c0392b;
}

.status.error {
  color: #c0392b;
  font-weight: 700;
}

.kb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kb-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--panel);
}

.kb-meta {
  font-size: 14px;
}

.kb-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 6px;
}

.kb-actions {
  display: flex;
  gap: 6px;
}

/* --- 刷新版ナレッジ検索（単一カラム / ステップUI） --- */
.main-single {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.caution-bar {
  margin: 0;
  font-size: 12px;
  color: #c0392b;
  font-weight: 700;
}

.step-card {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 6px solid var(--yellow);
  border-radius: 8px;
  padding: 16px 20px;
}

.step-card h2 {
  margin: 0 0 6px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--yellow-strong);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.tool-actions {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.ghost-btn {
  background: #fff;
  border: 1px solid var(--yellow-strong);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
}

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

.green-box {
  border: 2px solid #1e7e34;
  border-left: 6px solid #1e7e34;
}

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

/* チェックシート右パネルのツール選択（縦並び・コンパクト） */
.kb-tool-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.kb-tool-list .tool-chip {
  padding: 6px 8px;
  font-size: 12px;
}

.tool-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--panel);
  cursor: pointer;
  font-size: 13px;
}

.tool-chip:has(input:checked) {
  border-color: var(--yellow-strong);
  background: #fff7d6;
  box-shadow: inset 0 0 0 1px var(--yellow-strong);
}

.tool-chip input {
  width: 18px;
  height: 18px;
  accent-color: var(--yellow-strong);
  flex: none;
}

.tool-name {
  font-weight: 700;
}

.tool-cat {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

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

.adv {
  margin-top: 10px;
}

.adv summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

.adv-body {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 14px;
}

.adv-label {
  font-size: 12px;
  color: var(--muted);
}

.adv-fixed {
  font-size: 13px;
  font-weight: 600;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-entry {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 6px solid var(--yellow-strong);
  border-radius: 8px;
  padding: 16px 20px;
}

.result-q {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.q-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--muted);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.a-badge {
  display: inline-block;
  font-size: 18px;
  margin-right: 6px;
  vertical-align: -2px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.result-a {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 15px;
}

.result-cond {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.result-prompt {
  margin-top: 10px;
}

.result-prompt > summary {
  cursor: pointer;
  color: #b45309;
  font-size: 13px;
  font-weight: 600;
}

.prompt-note {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  margin: 8px 0;
}

.prompt-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 8px;
}

.prompt-pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.55;
  max-height: 360px;
  overflow: auto;
}

.result-detail {
  margin-top: 12px;
}

.result-detail summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 640px) {
  .search-row {
    flex-direction: column;
  }
}

/* ===== マルチエージェント UI ===== */
.components-info {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fffdf5;
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.components-info-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}
.components-info-list {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.components-info-list li {
  font-size: 12px;
  background: #fff8d6;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 8px;
}
.cat-pill {
  display: inline-block;
  background: #ffe680;
  border-radius: 8px;
  padding: 0 6px;
  margin-right: 4px;
  font-weight: 700;
  font-size: 11px;
}
.components-info-note {
  font-size: 12px;
  color: var(--muted);
}

/* マルチ結果テーブル */
.sub-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 12px;
}
.sub-table th, .sub-table td {
  border: 1px solid #ddd;
  padding: 4px 6px;
  vertical-align: top;
}
.sub-table th {
  background: #fff8d6;
}
.sub-row.sub-hit {
  background: #f1fbe7;
}
.sub-row.sub-miss {
  background: #fafafa;
  color: #777;
}
.sub-reason {
  max-width: 360px;
  white-space: normal;
}
.sub-prompt {
  margin: 6px 0;
  border-top: 1px dashed #ccc;
  padding-top: 6px;
}
.sub-prompt > summary {
  font-size: 12px;
}

/* ============================================================
   Multi-tenant admin panel styles
   ============================================================ */

.admin-tabs {
  display: flex;
  gap: 6px;
  background: var(--panel);
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.admin-tab {
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 16px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-weight: 600;
  color: #444;
}
.admin-tab.active {
  background: #fff;
  border-color: var(--border);
  border-bottom-color: transparent;
  color: var(--text);
}
.admin-panel { padding: 0 16px 24px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
}
.admin-table th, .admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
  text-align: left;
}
.admin-table th { background: #f8f8f0; }
.admin-table button { padding: 4px 8px; font-size: 12px; }

/* ==========================================================
 * 監査ログテーブル: 列幅固定 + セル内で折り返し
 * (詳細列に長い JSON が入っても表を突き破らないように)
 * ========================================================== */
.audit-log-table {
  table-layout: fixed;
  width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.audit-log-table th,
.audit-log-table td {
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}
.audit-log-table .col-time    { width: 14%; white-space: nowrap; }
.audit-log-table .col-tenant  { width: 12%; }
.audit-log-table .col-actor   { width: 18%; }
.audit-log-table .col-action  { width: 12%; }
.audit-log-table .col-detail  { width: auto; }

/* 単一テナント (Tenant列なし) の場合の幅配分 */
#audit-table:not(.audit-log-table) { table-layout: fixed; }
#audit-table:not(.audit-log-table) th,
#audit-table:not(.audit-log-table) td {
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  vertical-align: top;
}
#audit-table:not(.audit-log-table) .col-time   { width: 15%; white-space: nowrap; }
#audit-table:not(.audit-log-table) .col-actor  { width: 22%; }
#audit-table:not(.audit-log-table) .col-action { width: 15%; }
#audit-table:not(.audit-log-table) .col-detail { width: auto; }

.audit-log-table code,
#audit-table code {
  background: #f4f4ec;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 12px;
  word-break: break-all;
}

/* ==========================================================
 * バージョン履歴テーブル: 列幅固定 + 折り返し + 見た目調整
 * (email / filename / source_format が長くても表を突き破らない)
 * ========================================================== */
.pl-versions-scroll-wrap {
  overflow-x: auto;
  margin-top: 12px;
  /* 狭すぎる画面 (< 720px) では横スクロールでフォールバック */
  -webkit-overflow-scrolling: touch;
}
.pl-versions-table {
  table-layout: fixed;
  width: 100%;
  min-width: 720px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.pl-versions-table th,
.pl-versions-table td {
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  text-align: left;
}
.pl-versions-table th { background: #f8f8f0; }
.pl-versions-table .pv-col-version  { width: 60px;  white-space: nowrap; text-align: center; }
.pl-versions-table .pv-col-time     { width: 100px; white-space: nowrap; font-size: 12px; line-height: 1.35; }
.pl-versions-table .pv-col-user     { width: 20%; font-size: 12px; }
.pl-versions-table .pv-col-source   { width: 14%; }
.pl-versions-table .pv-col-filename { width: auto; font-size: 12px; }
.pl-versions-table .pv-col-chunks   { width: 68px; text-align: right; font-variant-numeric: tabular-nums; }
.pl-versions-table .pv-col-chars    { width: 88px; text-align: right; font-variant-numeric: tabular-nums; }
.pl-versions-table .pv-col-current  { width: 76px; text-align: center; }
.pl-versions-table .pv-col-op       { width: 116px; text-align: center; white-space: nowrap; }

/* source_format のピル (pdf / pdfplumber / gemini など) */
.pv-source-pill {
  display: inline-block;
  padding: 1px 6px;
  margin: 1px 2px 1px 0;
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  font-size: 11px;
  font-family: ui-monospace, Menlo, monospace;
  line-height: 1.5;
}

/* 現行世代バッジ */
.pv-current-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* ロールバックボタン */
.pv-rollback-btn {
  font-size: 11px !important;
  padding: 3px 8px !important;
}

.badge-imp {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 6px;
  font-size: 11px;
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffe69c;
  border-radius: 3px;
  white-space: nowrap;
}

.detail-muted {
  color: #888;
  font-size: 12px;
}

.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.inline-form input, .inline-form select {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.inline-form button {
  padding: 6px 14px;
  border: none;
  background: var(--yellow-strong);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}
.filter-row label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 2px;
}
.filter-row input, .filter-row select {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* super admin (専用) */
.sa-body { background: #f7f7fb; }
.sa-banner {
  background: #1e40af;
  color: #fff;
  text-align: center;
  padding: 8px;
  font-size: 12px;
  letter-spacing: 0.05em;
}
.sa-stats {
  display: flex;
  gap: 24px;
  padding: 16px 0;
}
.sa-stats .stat {
  display: flex;
  flex-direction: column;
  padding: 12px 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  min-width: 160px;
  background: #fff;
}
.sa-stats .stat-label { font-size: 12px; color: #555; }
.sa-stats .stat-value { font-size: 28px; font-weight: 700; }

/* ダッシュボードの遷移リンク: 統計カードと同じ見た目のクリック可能なタイル */
.dashboard-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
}
.dashboard-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border: 1px solid #d6d6c8;
  border-radius: 8px;
  background: #fff;
  color: #333;
  font-weight: 600;
  text-decoration: none;
  min-width: 200px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.dashboard-link:hover {
  background: #f8f8f0;
  border-color: #b8b8a8;
}
.dashboard-link:active {
  transform: translateY(1px);
}
.dashboard-link span[aria-hidden="true"] {
  margin-left: auto;
  color: #888;
}

.muted { color: #888; font-size: 11px; font-weight: normal; }
.hint {
  font-size: 12px;
  color: #666;
  margin-top: 8px;
}

.top-terms { padding-left: 20px; }
.top-terms li { margin-bottom: 6px; }

/* ページ間ナビ (ヘッダー右側のタブ) */
.header-tabs {
  display: flex;
  gap: 6px;
  margin-left: auto;
  align-items: center;
}
.header-tab {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.55);
  color: #333;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.05s ease;
}
.header-tab:hover {
  background: #fff;
}
.header-tab:active {
  transform: translateY(1px);
}
.header-tab.active {
  background: #111;
  color: var(--yellow);
  border-color: #111;
}

/* 統合アドミン内タブと外部ページタブ の区切り */
.header-tab-sep {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: rgba(0, 0, 0, 0.2);
  margin: 0 4px;
}
.header-tab.external {
  background: transparent;
  border-color: rgba(0, 0, 0, 0.25);
  color: #333;
}
.header-tab.external:hover {
  background: rgba(255, 255, 255, 0.7);
}

/* 招待URL表示ボックス */
.invite-url-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f0f9ff;
  border: 1px solid #7dd3fc;
  border-radius: 6px;
}
.invite-url-box label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #0c4a6e;
  margin-bottom: 6px;
}
.invite-url-box textarea {
  width: 100%;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
  background: #fff;
}
.invite-url-box button {
  font-size: 12px;
  padding: 2px 10px;
  margin-left: 8px;
}

/* =====================================================
   ヘッダーのログアウトボタン (全 variant 共通)
   ===================================================== */
.header-logout {
  background: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid rgba(0, 0, 0, 0.25) !important;
  color: #b91c1c !important;
  cursor: pointer;
}
.header-logout:hover {
  background: #fff !important;
  border-color: #b91c1c !important;
}

/* =====================================================
   ダッシュボード: 今月の入力件数カード
   ===================================================== */
.usage-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.usage-numbers {
  font-size: 15px;
}
.usage-count {
  font-size: 28px;
  font-weight: 700;
}
.usage-limit-text {
  color: #64748b;
}
.usage-remaining {
  color: #64748b;
  font-size: 13px;
  margin-left: 10px;
}
.usage-bar-outer {
  width: 100%;
  height: 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}
.usage-bar {
  height: 100%;
  transition: width 0.3s ease;
}
.usage-bar.ok       { background: #22c55e; }
.usage-bar.notice   { background: #eab308; }
.usage-bar.warn     { background: #f97316; }
.usage-bar.critical { background: #ef4444; }
.usage-bar.over     { background: #7f1d1d; }
.usage-note {
  font-size: 12px;
  color: #64748b;
  margin: 0;
}

/* =====================================================
   ask ページ: 月次上限バナー (app.js)
   ===================================================== */
.usage-banner {
  padding: 10px 14px;
  margin: 8px 0 12px 0;
  border-radius: 6px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.usage-banner.notice   { background: #fef9c3; border: 1px solid #eab308; color: #713f12; }
.usage-banner.warn     { background: #ffedd5; border: 1px solid #f97316; color: #7c2d12; }
.usage-banner.critical { background: #fee2e2; border: 1px solid #ef4444; color: #7f1d1d; }
.usage-banner.over     { background: #7f1d1d; border: 1px solid #7f1d1d; color: #fff; font-weight: 600; }

/* =====================================================
   ナレッジパイプライン
   ===================================================== */

/* モード選択 (追記/全置換) */
.pl-mode-fieldset {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 14px 12px;
  margin: 10px 0 8px;
  background: #f8fafc;
}
.pl-mode-fieldset legend {
  padding: 0 8px;
  font-size: 13px;
  color: #334155;
  font-weight: 600;
}
.pl-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 4px;
}
.pl-mode-option:hover { background: #eff6ff; }
.pl-mode-option input[type="radio"] { margin-top: 4px; }
.pl-mode-option strong { display: block; font-size: 14px; color: #0f172a; }
.pl-mode-option .muted { display: block; font-size: 12px; color: #64748b; margin-top: 2px; }
.pl-mode-option:has(input:checked) {
  background: #eff6ff;
  border-color: #3b82f6;
}
.pl-mode-danger:has(input:checked) {
  background: #fef2f2;
  border-color: #dc2626;
}

/* モードバナー */
.pl-mode-banner {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin: 6px 0 12px;
  line-height: 1.6;
}
.pl-mode-banner.append {
  background: #eff6ff;
  border: 1px solid #3b82f6;
  color: #1e3a8a;
}
.pl-mode-banner.replace {
  background: #fef2f2;
  border: 1px solid #dc2626;
  color: #7f1d1d;
  font-weight: 500;
}

/* 追加後プレビュー (append モード時のみ) */
.pl-merge-summary {
  padding: 10px 12px;
  border-radius: 6px;
  background: #ecfdf5;
  border: 1px solid #10b981;
  color: #064e3b;
  font-size: 13px;
  margin: 10px 0;
}
.pl-merge-summary .muted {
  color: #6b7280;
  font-size: 12px;
}

.pipeline-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}
.pipeline-toolbar label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.pipeline-toolbar select,
.pipeline-toolbar input[type="text"] {
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  min-width: 160px;
}
.pl-upload-label input[type="file"] {
  font-size: 12px;
}

.pipeline-header-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin: 10px 0;
}
.pipeline-header-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #475569;
}
.pipeline-header-grid input {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 14px;
}

.pl-cat-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}
.pl-cat-row {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fefefe;
}
.pl-cat-row.warn { border-color: #f59e0b; background: #fffbeb; }
.pl-cat-row.over { border-color: #ef4444; background: #fef2f2; }
.pl-cat-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
  margin-bottom: 4px;
}
.pl-cat-id {
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 700;
  color: #0f172a;
}
.pl-cat-name {
  color: #475569;
  flex: 1;
}
.pl-cat-chars {
  color: #64748b;
  font-size: 12px;
}
.pl-cat-bar-outer {
  height: 8px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}
.pl-cat-bar {
  height: 100%;
  background: #22c55e;
  transition: width 0.3s ease;
}
.pl-cat-row.warn .pl-cat-bar { background: #f59e0b; }
.pl-cat-row.over .pl-cat-bar { background: #ef4444; }
.pl-cat-over {
  color: #b91c1c;
  font-size: 12px;
  margin-top: 4px;
  font-weight: 600;
}

/* 参考表示のみの大項目行 (over_limit 判定を持たない) */
.pl-cat-row.info {
  border-color: #e2e8f0;
  background: #ffffff;
}
.pl-cat-row.info .pl-cat-bar { background: #94a3b8; }

/* category_id select (C1〜C6) */
.pl-cid-select {
  width: 100%;
  padding: 4px 6px;
  font-family: ui-monospace, Menlo, monospace;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
}
.pl-cid-select.invalid {
  border-color: #ef4444;
  background: #fef2f2;
  color: #b91c1c;
}
.pl-rows-table tr.pl-row-invalid td {
  background: #fef2f2;
}

/* 商材全体 (C1〜Cn 合計) の上限バー — 判定はここだけで行う */
.pl-total-row {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  margin-bottom: 6px;
}
.pl-total-row.warn { border-color: #f59e0b; background: #fffbeb; }
.pl-total-row.over { border-color: #ef4444; background: #fef2f2; }
.pl-total-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}
.pl-total-label {
  font-weight: 700;
  color: #0f172a;
}
.pl-total-chars {
  color: #334155;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.pl-total-row.ok .pl-cat-bar { background: #22c55e; }
.pl-total-row.warn .pl-cat-bar { background: #f59e0b; }
.pl-total-row.over .pl-cat-bar { background: #ef4444; }

.pl-rows-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.pl-rows-table th,
.pl-rows-table td {
  border: 1px solid #e2e8f0;
  padding: 6px 8px;
  vertical-align: top;
  font-size: 13px;
}
.pl-rows-table input,
.pl-rows-table textarea {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font: inherit;
  box-sizing: border-box;
}
.pl-rows-table textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}
.pl-row-chars {
  text-align: right;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}
.pl-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}
.pl-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =====================================================
   ask 側: Good/Bad フィードバックボタン
   ===================================================== */
.feedback-block {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feedback-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.feedback-btn {
  padding: 4px 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.feedback-btn:hover { background: #f1f5f9; }
.feedback-btn.selected.good {
  background: #22c55e;
  border-color: #16a34a;
  color: #fff;
}
.feedback-btn.selected.bad {
  background: #ef4444;
  border-color: #dc2626;
  color: #fff;
}
.feedback-comment {
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font: inherit;
  resize: vertical;
  box-sizing: border-box;
}
.feedback-note {
  font-size: 12px;
  color: #64748b;
}

/* ==========================================================
   モダンなパイプラインツールバーボタン + カスタムファイル入力
   ========================================================== */
.pipeline-toolbar {
  background: linear-gradient(180deg, #fafbff 0%, #f2f4fa 100%);
  border: 1px solid #dde2ef;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.04);
}
.pipeline-toolbar button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.pipeline-toolbar button:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.32);
  transform: translateY(-1px);
}
.pipeline-toolbar button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}
.pipeline-toolbar button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.4);
}
.pipeline-toolbar button.ghost {
  background: #fff;
  color: #2563eb;
  border-color: #cdd6f4;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.1);
}
.pipeline-toolbar button.ghost:hover {
  background: #f0f5ff;
}
.pipeline-toolbar select,
.pipeline-toolbar input[type="text"] {
  padding: 6px 10px;
  border: 1px solid #cdd6f4;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

/* 商材カードリスト (ドロップダウン置換) */
.pl-product-picker {
  margin: 10px 0 12px;
}
.pl-product-picker-title {
  font-size: 13px;
  color: #334155;
  font-weight: 600;
  margin-bottom: 6px;
}
.pl-product-picker-title .muted {
  font-weight: 400;
  margin-left: 8px;
}
.pl-product-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.pl-product-card {
  appearance: none;
  cursor: pointer;
  text-align: left;
  background: #fff;
  border: 2px solid #dbe2f2;
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
  font: inherit;
  color: inherit;
}
.pl-product-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}
.pl-product-card.selected {
  border-color: #2563eb;
  background: linear-gradient(180deg, #eff5ff 0%, #dbe8ff 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
}
.pl-product-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.pl-product-card-id {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  background: #eef4ff;
  color: #2563eb;
  padding: 2px 6px;
  border-radius: 4px;
}
.pl-product-card-title {
  font-weight: 700;
  font-size: 13px;
  color: #1e293b;
  line-height: 1.3;
  margin-bottom: 4px;
}
.pl-product-card-sub {
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* カスタムファイル入力 - ネイティブは隠して見た目を統一 */
.pl-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.pl-upload-label input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.pl-upload-label::before {
  content: "📎 ファイルを選択";
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f2f4fa 100%);
  border: 1px solid #cdd6f4;
  color: #2563eb;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.pl-upload-label:hover::before {
  background: linear-gradient(180deg, #f8faff 0%, #e7ecff 100%);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.18);
}
.pl-upload-label .pl-upload-filename {
  font-size: 12px;
  color: #475569;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 既存ナレッジ (マージモード時の読み取り専用プレビュー) */
.pl-existing-rows-box {
  margin: 12px 0 16px;
  border: 2px solid #93c5fd;
  background: #eff6ff;
  border-radius: 10px;
  padding: 12px 14px;
}
.pl-existing-rows-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.pl-existing-rows-head strong {
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}
.pl-existing-rows-head .muted {
  font-size: 12px;
  color: #64748b;
}
.pl-existing-toggle {
  margin-left: auto;
  padding: 4px 10px !important;
  font-size: 12px !important;
}
.pl-existing-rows-table {
  font-size: 12px;
}
.pl-existing-rows-table th {
  background: #dbeafe;
  color: #1e3a8a;
}
.pl-existing-rows-table td {
  padding: 6px 8px;
  vertical-align: top;
  background: #f8fbff;
}
.pl-existing-text {
  white-space: pre-wrap;
  color: #334155;
  max-width: 560px;
}
.pl-existing-rows-box.collapsed .pl-existing-rows-table {
  display: none;
}

/* 追加分セクション (append モード時) を目立たせる緑帯 */
.pl-incoming-heading {
  margin: 18px 0 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid #34d399;
  background: linear-gradient(90deg, #ecfdf5 0%, #d1fae5 100%);
  color: #064e3b;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pl-incoming-heading .muted {
  font-weight: 400;
  color: #047857;
  font-size: 12px;
}

/* 「今回追加するナレッジ」の大項目丸ごと削除パネル (incoming-heading の直下) */
.pl-incoming-cat-delete {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px dashed #fca5a5;
  background: #fef2f2;
}
.pl-incoming-cat-delete-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.pl-incoming-cat-delete-head strong {
  color: #991b1b;
  font-size: 13px;
}
.pl-incoming-cat-delete-head .muted {
  font-size: 12px;
  color: #64748b;
}
.pl-incoming-cat-delete-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pl-cat-del-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #ffffff;
  border: 1px solid #fca5a5;
  color: #991b1b;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.pl-cat-del-chip:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #7f1d1d;
}
.pl-cat-del-chip-id {
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 700;
}
.pl-cat-del-chip-name {
  color: #475569;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pl-cat-del-chip-count {
  color: #64748b;
  font-size: 11px;
}
.pl-cat-del-chip-icon {
  font-size: 13px;
}
.pl-rows-table.append-mode {
  border: 2px solid #34d399;
  border-radius: 8px;
  overflow: hidden;
}
.pl-rows-table.append-mode th {
  background: #d1fae5;
  color: #064e3b;
}
.pl-rows-table.append-mode tbody td {
  background: #f0fdf4;
}
.pl-rows-table.append-mode tbody tr td:first-child::before {
  content: "🆕";
  margin-right: 4px;
}

/* PDF アップロード時のみ表示する Gemini 分割オプション */
.pl-pdf-opts {
  margin: 8px 0 4px;
  padding: 8px 12px;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 13px;
}
.pl-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.pl-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.pl-checkbox .muted {
  color: #64748b;
  font-size: 12px;
  font-weight: 400;
}

/* ==========================================================
   PDF 全文パネル (AI OFF 時のコピペ元)
   ========================================================== */
.pl-pdf-source-panel {
  margin: 14px 0 18px;
  border: 2px solid #f59e0b;
  background: #fffbeb;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.12);
}
.pl-pdf-source-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.pl-pdf-source-head strong {
  background: #f59e0b;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}
.pl-pdf-source-head .muted {
  font-size: 12px;
  color: #92400e;
}
.pl-pdf-source-head .ghost {
  margin-left: auto;
  font-size: 12px;
  padding: 4px 10px !important;
}
.pl-pdf-close-btn {
  margin-left: 4px !important;
  padding: 2px 10px !important;
  font-weight: 700;
  color: #92400e !important;
}
.pl-pdf-source-hint {
  margin: 4px 0 10px;
  padding: 8px 12px;
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: 4px;
  font-size: 13px;
  color: #78350f;
  line-height: 1.6;
}
.pl-pdf-source-hint strong {
  color: #92400e;
}
.pl-pdf-source-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #fcd34d;
  border-radius: 8px;
}
.pl-pdf-cat-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #78350f;
  font-weight: 600;
}
.pl-pdf-cat-picker select {
  padding: 4px 8px;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  font-weight: 700;
  color: #92400e;
  background: #fffbeb;
}
.pl-pdf-cat-name {
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  min-width: 140px;
  font-size: 13px;
}
.pl-pdf-row-title {
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  min-width: 180px;
  font-size: 13px;
}
.pl-pdf-add-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #fff !important;
  border: none !important;
  padding: 8px 14px !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.pl-pdf-add-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
}
.pl-pdf-source-text {
  max-height: 480px;
  overflow-y: auto;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.85;
  color: #1f2937;
  user-select: text;
  cursor: text;
}
.pl-pdf-source-text::selection {
  background: #fbbf24;
  color: #451a03;
}
.pl-pdf-source-text p {
  margin: 0 0 12px;
}
.pl-pdf-source-text .pl-pdf-heading {
  display: block;
  margin: 14px 0 6px;
  padding: 4px 10px;
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  font-weight: 700;
  color: #78350f;
  font-size: 15px;
  border-radius: 4px;
}
/* パネル全体を折りたたむトグル用の class */
.pl-pdf-source-panel.collapsed .pl-pdf-source-text,
.pl-pdf-source-panel.collapsed .pl-pdf-source-hint,
.pl-pdf-source-panel.collapsed .pl-pdf-source-actions {
  display: none;
}

/* ==========================================================
   検索画面: 画面外周を巡回する 🤖 ロボット (JS 制御・ランダムパターン)
   ========================================================== */
.robot-orbit {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease;
}
.robot-orbit.is-visible {
  opacity: 1;
  visibility: visible;
}
.robot-orbit .robot {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 26px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
  opacity: 0.85;
  will-change: transform;
  /* 各ロボットは JS で --dur (周期) / --delay (時間差) / animation-name を注入する */
  animation-duration: var(--dur, 20s);
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-delay: var(--delay, 0s);
}
/* 追加装飾: ふわっとバウンスするサブアニメーション */
.robot-orbit .robot.robot-bounce { animation-name: robot-bounce; }

/* === パターン 1: 時計回りに外周を巡回 === */
.robot-orbit .robot.pt-cw { animation-name: robot-pattern-cw; }
@keyframes robot-pattern-cw {
  0%   { transform: translate(20px, 20px); }
  25%  { transform: translate(calc(100vw - 60px), 20px); }
  50%  { transform: translate(calc(100vw - 60px), calc(100vh - 60px)); }
  75%  { transform: translate(20px, calc(100vh - 60px)); }
  100% { transform: translate(20px, 20px); }
}
/* === パターン 2: 反時計回り === */
.robot-orbit .robot.pt-ccw { animation-name: robot-pattern-ccw; }
@keyframes robot-pattern-ccw {
  0%   { transform: translate(20px, 20px); }
  25%  { transform: translate(20px, calc(100vh - 60px)); }
  50%  { transform: translate(calc(100vw - 60px), calc(100vh - 60px)); }
  75%  { transform: translate(calc(100vw - 60px), 20px); }
  100% { transform: translate(20px, 20px); }
}
/* === パターン 3: 対角ジグザグ (左上→右下→左下→右上→左上) === */
.robot-orbit .robot.pt-zigzag { animation-name: robot-pattern-zigzag; }
@keyframes robot-pattern-zigzag {
  0%   { transform: translate(20px, 20px); }
  25%  { transform: translate(calc(100vw - 60px), calc(100vh - 60px)); }
  50%  { transform: translate(20px, calc(100vh - 60px)); }
  75%  { transform: translate(calc(100vw - 60px), 20px); }
  100% { transform: translate(20px, 20px); }
}
/* === パターン 4: 上端左右往復 === */
.robot-orbit .robot.pt-topbounce { animation-name: robot-pattern-topbounce; }
@keyframes robot-pattern-topbounce {
  0%   { transform: translate(20px, 20px); }
  50%  { transform: translate(calc(100vw - 60px), 20px); }
  100% { transform: translate(20px, 20px); }
}
/* === パターン 5: 下端左右往復 === */
.robot-orbit .robot.pt-bottombounce { animation-name: robot-pattern-bottombounce; }
@keyframes robot-pattern-bottombounce {
  0%   { transform: translate(20px, calc(100vh - 60px)); }
  50%  { transform: translate(calc(100vw - 60px), calc(100vh - 60px)); }
  100% { transform: translate(20px, calc(100vh - 60px)); }
}
/* === パターン 6: 左端上下往復 === */
.robot-orbit .robot.pt-leftbounce { animation-name: robot-pattern-leftbounce; }
@keyframes robot-pattern-leftbounce {
  0%   { transform: translate(20px, 20px); }
  50%  { transform: translate(20px, calc(100vh - 60px)); }
  100% { transform: translate(20px, 20px); }
}
/* === パターン 7: 右端上下往復 === */
.robot-orbit .robot.pt-rightbounce { animation-name: robot-pattern-rightbounce; }
@keyframes robot-pattern-rightbounce {
  0%   { transform: translate(calc(100vw - 60px), 20px); }
  50%  { transform: translate(calc(100vw - 60px), calc(100vh - 60px)); }
  100% { transform: translate(calc(100vw - 60px), 20px); }
}
/* === パターン 8: 8 の字 === */
.robot-orbit .robot.pt-eight { animation-name: robot-pattern-eight; }
@keyframes robot-pattern-eight {
  0%   { transform: translate(20px, 20px); }
  25%  { transform: translate(calc(100vw - 60px), calc(100vh / 2)); }
  50%  { transform: translate(20px, calc(100vh - 60px)); }
  75%  { transform: translate(calc(100vw - 60px), calc(100vh / 2)); }
  100% { transform: translate(20px, 20px); }
}
/* === パターン 9: 螺旋 (中央から外へ) === */
.robot-orbit .robot.pt-spiral { animation-name: robot-pattern-spiral; }
@keyframes robot-pattern-spiral {
  0%   { transform: translate(calc(50vw - 20px), calc(50vh - 20px)); }
  20%  { transform: translate(calc(50vw + 100px), calc(50vh - 20px)); }
  40%  { transform: translate(calc(50vw), calc(50vh + 100px)); }
  60%  { transform: translate(calc(50vw - 150px), calc(50vh)); }
  80%  { transform: translate(calc(50vw), calc(50vh - 150px)); }
  100% { transform: translate(calc(50vw - 20px), calc(50vh - 20px)); }
}
/* === パターン 10: ランダム散策 (5 ポイント巡回) === */
.robot-orbit .robot.pt-wander { animation-name: robot-pattern-wander; }
@keyframes robot-pattern-wander {
  0%   { transform: translate(80px, 60px); }
  20%  { transform: translate(calc(100vw - 120px), calc(100vh - 90px)); }
  40%  { transform: translate(calc(100vw / 2), 40px); }
  60%  { transform: translate(60px, calc(100vh - 70px)); }
  80%  { transform: translate(calc(100vw - 80px), calc(100vh / 3)); }
  100% { transform: translate(80px, 60px); }
}
/* サブ: ちょっと縦にバウンド (JS で ptクラスと組み合わせる時のみ使用) */
@keyframes robot-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-14px); }
}

/* === ロボット列車: 🤖 6 体を横一列にして外周を走らせる === */
.robot-train {
  position: fixed;
  top: 14px;
  left: -360px;
  z-index: 0;
  pointer-events: none;
  display: flex;
  flex-wrap: nowrap;
  white-space: nowrap;
  gap: 2px;
  width: max-content;
  opacity: 0;
  visibility: hidden;
  will-change: transform;
}
.robot-train.is-visible { visibility: visible; }
.robot-train.robot-train-bottom {
  top: auto;
  bottom: 14px;
}
.robot-train.is-visible {
  animation: robot-train-run 16s linear both;
}
.robot-train-car {
  display: inline-block;
  font-size: 29px;
  line-height: 1;
  opacity: 0.92;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
  animation: robot-train-car-bob 0.65s ease-in-out var(--car-delay, 0s) infinite alternate;
}
@keyframes robot-train-run {
  0%   { opacity: 0; transform: translateX(0); }
  4%   { opacity: 1; }
  96%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(calc(100vw + 450px)); }
}
@keyframes robot-train-car-bob {
  from { transform: translateY(0); }
  to   { transform: translateY(-6px); }
}

/* === 親玉: 画面左端から "横倒しの頭の上半分" を "にゅー" と出す ===
   顔を 90 度 CW 回転させ (元の頭の上=右向き)、
   その "回転後の右半分" (=元の顔の上半分) だけをコンテナで切り抜く。
   にゅー動作は translateX(-100%) → (-50%) の水平スライド。 */
.robot-boss-peek {
  position: fixed;
  left: 0;
  top: 50%;
  z-index: 0;
  /* コンテナは顔と同じ高さで、幅は顔の半分。顔の左半分が画面外に落ちる。 */
  width: min(26vh, 22vw);
  height: min(52vh, 44vw);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.9s ease;
  will-change: opacity;
}
.robot-boss-peek.is-visible {
  opacity: 0.96;
}
.robot-boss-face {
  position: absolute;
  left: 0;
  top: 0;
  /* 顔ボックスを font-size と同じ正方形に固定 (%変換の基準を安定させる) */
  width: min(52vh, 44vw);
  height: min(52vh, 44vw);
  font-size: min(52vh, 44vw);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 初期: 画面外へ完全退避 (90度 CW 回転済み) */
  transform: translateX(-100%) rotate(90deg);
  transition: transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(6px 4px 14px rgba(0, 0, 0, 0.28));
  animation: robot-boss-breathe 2.8s ease-in-out infinite;
}
.robot-boss-peek.is-visible .robot-boss-face {
  /* 顔の左半分は画面外、回転後の右半分 (=元の頭上半分) だけを見せる */
  transform: translateX(-50%) rotate(90deg);
}
@keyframes robot-boss-breathe {
  0%, 100% { scale: 1; }
  50%      { scale: 1.025; }
}

@media (prefers-reduced-motion: reduce) {
  .robot-orbit,
  .robot-train,
  .robot-boss-peek { display: none; }
}

/* ==========================================================
   ナレッジパイプライン: 3 ビュー (list / pdf / excel) 切替
   ========================================================== */
.pl-view-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
}
.pl-view-crumb {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #475569;
}
.pl-view-crumb.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  font-weight: 600;
}
.pl-view-crumb:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
.pl-view-arrow {
  color: #94a3b8;
  font-size: 18px;
}

/* --- PDF 編集ビュー --- */
.pl-pdf-view-card {}
.pl-pdf-view-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}
.pl-pdf-view-actions {
  display: flex;
  gap: 8px;
}
.pl-pdf-view-actions .primary {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}
.pl-pdf-view-actions .primary:hover {
  background: #15803d;
}
.pl-pdf-workspace {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}
@media (max-width: 1200px) {
  .pl-pdf-workspace { grid-template-columns: 1fr; }
}
.pl-pdf-merge-panel {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.pl-pdf-merge-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #cbd5e1;
}
.pl-pdf-cat-manager {
  margin-bottom: 12px;
}
.pl-pdf-cat-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
}
.pl-pdf-cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
  min-height: 30px;
  padding: 4px;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
}
.pl-pdf-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 12px;
  font-size: 12px;
  color: #1e40af;
}
.pl-pdf-cat-chip.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}
.pl-pdf-cat-chip button {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
}
.pl-pdf-cat-add {
  display: flex;
  gap: 6px;
}
.pl-pdf-cat-add input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12px;
}
.pl-pdf-add-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  margin-bottom: 10px;
}
.pl-pdf-add-row label {
  font-size: 12px;
  color: #64748b;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pl-pdf-add-row input,
.pl-pdf-add-row select {
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 13px;
}
.pl-pdf-add-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.pl-pdf-add-primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  font-weight: 600;
}
.pl-pdf-add-primary:hover { background: #1d4ed8; }
.pl-pdf-merge-stats {
  padding: 6px 8px;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 4px;
  font-size: 12px;
  color: #065f46;
  margin-bottom: 6px;
}
.pl-pdf-added-rows {
  padding-left: 20px;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
}
.pl-pdf-added-rows li {
  margin-bottom: 3px;
  color: #475569;
}
.pl-pdf-added-rows li .cid {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  background: #dbeafe;
  color: #1e40af;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  margin-right: 4px;
}
.pl-pdf-fulltext-panel {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}
.pl-pdf-fulltext-head {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}
.pl-pdf-fulltext-head strong { flex: 0 0 auto; }
.pl-pdf-fulltext-head .muted { flex: 1; font-size: 12px; }
#pl-pdf-fulltext-body {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 12px 16px;
  white-space: pre-wrap;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  user-select: text;
}
#pl-pdf-fulltext-body .pl-pdf-heading {
  display: block;
  font-weight: 700;
  color: #1e40af;
  background: #dbeafe;
  padding: 2px 6px;
  margin: 4px 0;
  border-radius: 3px;
}

/* --- Excel 風スプレッドシートビュー --- */
.pl-excel-view-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}
.pl-excel-view-actions {
  display: flex;
  gap: 8px;
}
.pl-excel-view-actions .primary {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}
.pl-excel-view-actions .primary:hover {
  background: #15803d;
}
.pl-excel-header-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
  margin: 12px 0;
}
.pl-excel-header-grid label {
  font-size: 12px;
  color: #64748b;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pl-excel-header-grid input {
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 13px;
}
.pl-excel-stats {
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 12px;
}
.pl-excel-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.pl-excel-scroll-wrap {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow: auto;
  max-height: calc(100vh - 380px);
  background: #ffffff;
}
.pl-excel-grid {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.pl-excel-grid thead th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #334155;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  font-weight: 600;
  text-align: left;
  z-index: 2;
}
.pl-excel-grid tbody td {
  padding: 4px 8px;
  border: 1px solid #e2e8f0;
  vertical-align: top;
  background: #ffffff;
  outline: none;
  min-height: 22px;
}
.pl-excel-grid tbody td[contenteditable="true"]:focus {
  background: #eff6ff;
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}
.pl-excel-grid tbody tr.selected td { background: #dbeafe; }
.pl-excel-grid tbody td.pl-excel-rownum {
  width: 40px;
  text-align: center;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  user-select: none;
  position: sticky;
  left: 0;
  z-index: 1;
  font-weight: 600;
  border-right: 2px solid #cbd5e1;
}
.pl-excel-grid tbody td.pl-excel-chars {
  text-align: right;
  color: #64748b;
  background: #f8fafc;
  cursor: default;
}
.pl-excel-grid tbody td.pl-excel-chars.over {
  color: #b91c1c;
  font-weight: 700;
}
.pl-excel-grid .pl-excel-corner {
  width: 40px;
  background: #e2e8f0 !important;
  text-align: center;
}

