/* ============================================================
   mock.css — AI業務環境モック（CiviLink Design System 適用）
   colors_and_type.css を前提に、ui_kits/civilink-app/app.css の
   イディオムを流用しつつチャット／管理コンソール固有要素を定義。
   ============================================================ */

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); }
[hidden] { display: none !important; }

/* ---------- アイコン（Lucide スプライトを app.js が注入） ---------- */
.ico {
  display: inline-block; vertical-align: middle; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ブランドロゴ（黒on白 JPEG）：明るい面では白地を mix-blend で溶かす */
.sidebar .brand img, .admin-head img, .landing .hero img { mix-blend-mode: multiply; }

/* ============================================================
   アプリシェル
   ============================================================ */
.app { display: grid; grid-template-columns: 260px 1fr; height: 100vh; width: 100vw; overflow: hidden; }
.main { background: var(--bg); display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ============================================================
   トップバー（AI業務環境ヘッダー）
   ============================================================ */
.topbar {
  background: var(--bg); border-bottom: 1px solid var(--border);
  height: 64px; display: flex; align-items: center; padding: 0 24px; gap: 14px; flex-shrink: 0;
}
.topbar h1 { font-size: var(--size-h4); font-weight: var(--weight-bold); color: var(--text-primary); }
.topbar .tag {
  display: inline-flex; align-items: center; height: 26px; padding: 0 12px;
  background: var(--secondary); color: var(--text-icon);
  border-radius: var(--radius-full); font-size: var(--size-xs); font-weight: var(--weight-medium);
}
.topbar .spacer { flex: 1; }
.topbar .org {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px;
  background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: var(--size-sm); color: var(--text-primary);
}
.topbar .org .ico { color: var(--text-icon); }
.topbar .user { font-size: var(--size-sm); color: var(--text-secondary); }
.topbar .btn-logout {
  border: 1px solid var(--border); background: var(--bg); color: var(--text-primary);
  border-radius: var(--radius); padding: 7px 14px; font-size: var(--size-sm);
  font-family: inherit; cursor: pointer; transition: background var(--transition);
}
.topbar .btn-logout:hover { background: var(--bg-sidebar); }

/* ============================================================
   サイドバー（ファイルツリー版）
   ============================================================ */
.sidebar {
  background: var(--bg-sidebar); border-right: 1px solid var(--border);
  padding: 16px; display: flex; flex-direction: column; gap: 4px; overflow: hidden;
}
/* 3タブ本体：中段はスクロール、下部リンク集は常時固定 */
.side-panels { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.side-panel { display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.side-panel[data-panel="files"] { flex: 1; }

/* スキルタブ一覧 */
.side-skill-list { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.side-skill {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: var(--radius);
  cursor: pointer; font-size: var(--size-sm); color: var(--text-primary); transition: background var(--transition);
}
.side-skill:hover { background: var(--bg-hover); }
.side-skill .ico { color: var(--primary); }
.side-skill .seq { color: var(--text-secondary); font-weight: var(--weight-bold); margin-right: 1px; }

/* 履歴タブ */
.history-list { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.history-item {
  padding: 9px 10px; border-radius: var(--radius); cursor: pointer; font-size: var(--size-sm);
  color: var(--text-primary); transition: background var(--transition);
}
.history-item:hover { background: var(--bg-hover); }
.history-item .h-time { display: block; font-size: var(--size-2xs); color: var(--text-secondary); margin-top: 2px; }

/* 下部固定リンク集 */
.side-links { flex-shrink: 0; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; }
.side-links-head { font-size: var(--size-2xs); font-weight: var(--weight-bold); color: var(--text-secondary); padding: 0 8px 6px; letter-spacing: .04em; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius);
  text-decoration: none; color: var(--text-primary); font-size: var(--size-sm); transition: background var(--transition);
}
.side-link:hover { background: var(--bg-hover); text-decoration: none; }
.side-link .ico { color: var(--text-icon); }
.side-link .ext { margin-left: auto; color: var(--text-secondary); }
.sidebar .brand { display: flex; align-items: center; gap: 9px; padding: 2px 4px 12px; }
.sidebar .brand img { display: block; }
.sidebar .brand .meta { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar .brand .meta b { font-size: var(--size-md); font-weight: var(--weight-bold); color: var(--text-primary); }
.sidebar .brand .meta small { font-size: var(--size-2xs); color: var(--text-secondary); font-weight: var(--weight-medium); }

/* 新規チャット */
.new-chat {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary-background); color: var(--primary);
  border: 1px solid transparent; border-radius: var(--radius-md);
  height: 44px; font-size: var(--size-md); font-weight: var(--weight-bold);
  cursor: pointer; transition: background var(--transition);
}
.new-chat:hover { background: #d6edff; }

/* 履歴／ファイル タブ */
.side-tabs { display: flex; border-bottom: 1px solid var(--border); margin: 12px 0 12px; }
.side-tabs .tab {
  flex: 1; text-align: center; padding: 10px 0; font-size: var(--size-body);
  color: var(--text-secondary); cursor: pointer; position: relative; font-weight: var(--weight-medium);
}
.side-tabs .tab.active { color: var(--text-primary); font-weight: var(--weight-bold); }
.side-tabs .tab.active::after {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: -1px; width: 56px; height: 3px; border-radius: 2px; background: var(--primary);
}

/* 検索 */
.side-search {
  display: flex; align-items: center; gap: 8px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 9px 12px; margin-bottom: 12px;
}
.side-search .ico { color: var(--text-secondary); }
.side-search input { border: 0; background: none; outline: 0; flex: 1; font-family: inherit; font-size: var(--size-sm); color: var(--text-primary); }
.side-search input::placeholder { color: var(--text-secondary); }

/* 管理動線（アップロード／新規フォルダ） */
.side-tools { display: flex; gap: 8px; margin-bottom: 14px; }
.side-tools .tool {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text-primary); font-size: var(--size-sm);
  font-family: inherit; cursor: pointer; transition: background var(--transition);
}
.side-tools .tool:hover { background: var(--bg-hover); }
.side-tools .tool.accent { background: var(--primary-background); border-color: transparent; color: var(--primary); }
.side-tools .tool.accent:hover { background: #d6edff; }
.side-tools .tool .ico { color: inherit; }

/* フォルダツリー */
.tree { display: flex; flex-direction: column; gap: 2px; }
.tree-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 8px; border-radius: var(--radius);
  cursor: pointer; position: relative; font-size: var(--size-sm); color: var(--text-primary);
}
.tree-row:hover { background: var(--bg-hover); }
.tree-row.folder { font-weight: var(--weight-bold); }
.tree-row.file { padding-left: 30px; }
.tree-row.selected { background: var(--primary-background); }
.tree-row.selected::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
  border-radius: 2px; background: var(--primary);
}
.tree-row .chev { color: var(--text-icon); width: 14px; display: inline-flex; justify-content: center; }
.tree-row .chev.r { transform: rotate(-90deg); }
.tree-row .ico-file { color: var(--text-icon); }
.tree-row .count { margin-left: 6px; font-size: var(--size-xs); color: var(--text-secondary); font-weight: var(--weight-regular); }
.tree-row .kebab { margin-left: auto; color: var(--text-secondary); opacity: 0; }
.tree-row:hover .kebab { opacity: 1; }

.tree-hint { margin-top: auto; padding: 14px 6px 4px; font-size: var(--size-xs); color: var(--text-secondary); line-height: 1.6; }

/* ファイル種別アイコン色（Lucide file をベースに着色） */
.ico-file.pdf  { color: var(--destructive); }
.ico-file.xlsx { color: #1c9d5a; }
.ico-file.docx { color: var(--primary); }
.ico-file.dir  { color: var(--yellow); }

/* ============================================================
   チャット本体
   ============================================================ */
.chat-scroll { flex: 1; overflow-y: auto; padding: 24px 32px; display: flex; flex-direction: column; gap: 18px; }
.chat-inner { max-width: 1100px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

/* AI 案内・応答ラベル */
.ai-note { display: flex; align-items: flex-start; gap: 10px; color: var(--text-secondary); font-size: var(--size-body); }
.ai-note .ico { color: var(--primary); margin-top: 1px; }

/* ユーザー発話バブル（右寄せ） */
.bubble-user {
  align-self: flex-end; max-width: 680px; background: var(--primary-background);
  color: var(--text-primary); border-radius: var(--radius-lg); border-top-right-radius: var(--radius-sm);
  padding: 12px 16px; font-size: var(--size-md); line-height: 2.1;
}
/* 発話バブル内のインラインチップ（入力コンポーザーと同一イディオム）。
   青地のバブル上ではチップ地を白にしてコントラストを確保。 */
.bubble-user .file-pill,
.bubble-user .skill-pill { background: var(--bg); }

/* ============================================================
   入力コンポーザー（テキスト＝コンテキストにファイルをインライン混在）
   A/B 固定スロットは持たない。ファイル参照はテキストフローの任意位置に
   チップとして差し込めるため、文中・文末どこにでも「紛れ込ませる」ことができる。
   ============================================================ */
.composer-area { border-top: 1px solid var(--border); background: var(--bg); padding: 16px 32px 22px; }
.composer-wrap { max-width: 1100px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; }

.composer {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px 16px; min-height: 64px; display: flex; flex-direction: column; justify-content: center;
}
.composer:focus-within { border-color: var(--primary); box-shadow: var(--focus-ring-primary); }
/* 編集領域：テキストとチップが通常のテキストフローで混在（行高はチップが収まる広さ） */
.composer .editable { font-size: var(--size-md); color: var(--text-primary); line-height: 2.15; outline: 0; }
.composer .editable .ph { color: var(--text-secondary); }
.composer .caret { display: inline-block; width: 2px; height: 18px; background: var(--text-primary); margin: 0 1px; vertical-align: -3px; animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.composer .hint { font-size: var(--size-sm); color: var(--text-secondary); margin-top: 8px; }

/* 文中インラインのファイル参照チップ（テキストの流れに乗る） */
.file-pill {
  display: inline-flex; align-items: center; gap: 6px; vertical-align: middle;
  background: var(--secondary); border-radius: var(--radius-md); padding: 3px 8px;
  font-size: var(--size-sm); color: var(--text-primary); white-space: nowrap;
}
.file-pill .ico-file { color: var(--text-icon); }
.file-pill .x { color: var(--text-secondary); cursor: pointer; margin-left: 1px; }

/* 文中インラインのスキルチップ（/スキル名） */
.skill-pill {
  display: inline-flex; align-items: center; gap: 6px; vertical-align: middle;
  background: var(--primary-background); color: var(--primary); border-radius: var(--radius-md);
  padding: 3px 10px; font-size: var(--size-sm); font-weight: var(--weight-medium); white-space: nowrap;
}

/* 操作ボタン（コンポーザー左右） */
.composer-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: 64px; min-width: 64px; padding: 0 14px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg); color: var(--text-primary);
  font-size: var(--size-xs); font-family: inherit; cursor: pointer; transition: background var(--transition);
}
.composer-btn:hover { background: var(--bg-hover); }
.composer-btn.accent { background: var(--primary-background); border-color: transparent; color: var(--primary); font-weight: var(--weight-medium); }
.composer-btn.accent:hover { background: #d6edff; }
.composer-btn .ico { color: inherit; }
.composer-btn.send { background: var(--primary); border-color: transparent; color: #fff; font-weight: var(--weight-bold); font-size: var(--size-md); }
.composer-btn.send:hover { background: var(--primary-hover); }

/* ============================================================
   出力レポートカード
   ============================================================ */
.report {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px 32px; box-shadow: var(--shadow-2);
}
.report h2 { font-size: var(--size-h2); margin-bottom: 14px; }
.report .rule { border: 0; border-top: 1px solid var(--border); margin: 0 0 14px; }
.report .summary { font-size: var(--size-sm); color: var(--text-secondary); margin-bottom: 22px; }

.report .sec-head { display: flex; align-items: center; gap: 14px; margin: 22px 0 12px; }
.report .sec-head::before { content: ''; width: 4px; height: 22px; border-radius: 2px; background: var(--primary); }
.report .sec-head h3 { font-size: var(--size-h4); font-weight: var(--weight-bold); }

/* 照査表 */
.review-tbl { width: 100%; border-collapse: collapse; font-size: var(--size-body); }
.review-tbl thead th {
  text-align: left; font-weight: var(--weight-medium); color: var(--text-icon);
  font-size: var(--size-sm); padding: 9px 12px; background: var(--bg-sidebar); border-bottom: 1px solid var(--border);
}
.review-tbl tbody td { padding: 12px; border-bottom: 1px solid var(--bg-sidebar); color: var(--text-primary); vertical-align: middle; }
.review-tbl td.warn { color: var(--primary); }
.review-tbl td.muted { color: var(--text-secondary); }
.review-tbl td.judge { width: 110px; text-align: right; }

/* 出力ファイルリンク */
.out-files { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.out-files .label { font-size: var(--size-sm); color: var(--text-secondary); }
.out-link {
  display: inline-flex; align-items: center; gap: 8px; background: var(--primary-background);
  border: 1px solid transparent; border-radius: var(--radius); padding: 7px 12px;
  font-size: var(--size-sm); color: var(--primary); cursor: pointer; text-decoration: none;
}
.out-link:hover { background: #d6edff; text-decoration: none; }
.report .note { font-size: var(--size-sm); color: var(--text-secondary); margin-top: 14px; line-height: 1.6; }

/* ============================================================
   ステータス pill / chip / btn（app.css 流用 + 拡張）
   ============================================================ */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--radius-full); font-size: var(--size-sm); font-weight: var(--weight-medium); line-height: 1.4; }
.pill.ok      { background: rgba(77,222,145,.18); color: #1c9d5a; }
.pill.ng      { background: rgba(255,51,102,.12); color: var(--destructive); }
.pill.check   { background: #fff4dc; color: #b87600; }
.pill.active  { background: rgba(77,222,145,.18); color: #1c9d5a; }
.pill.warn-sm { background: var(--primary-background); color: var(--primary); }

.btn {
  font-family: var(--font-jp); font-size: var(--size-body); font-weight: var(--weight-bold);
  border: 0; border-radius: var(--radius); padding: 10px 16px; cursor: pointer;
  box-shadow: var(--shadow-1); transition: background var(--transition);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.secondary { background: var(--bg); color: var(--text-primary); box-shadow: none; border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--bg-hover); }
.btn.danger { background: var(--destructive); color: #fff; }
.btn.danger:hover { background: var(--destructive-hover); }
.btn.ghost { background: transparent; color: var(--text-primary); box-shadow: none; }
.btn.ghost:hover { background: var(--bg-hover); }

/* ============================================================
   スキル選択モーダル
   ============================================================ */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; animation: scrim-in 200ms ease; }
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 900px; max-width: calc(100vw - 48px); background: var(--bg); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow-3); animation: modal-in 200ms ease;
}
@keyframes modal-in { from { transform: scale(.98); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal .modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.modal .modal-head h3 { font-size: var(--size-h3); font-weight: var(--weight-bold); margin-bottom: 6px; }
.modal .modal-head p { font-size: var(--size-sm); color: var(--text-secondary); }
.modal .close { width: 36px; height: 36px; border-radius: var(--radius-md); background: var(--secondary); border: 0; color: var(--text-icon); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal .close:hover { background: var(--secondary-hover); }
.modal .modal-search {
  display: flex; align-items: center; gap: 8px; background: var(--bg-sidebar);
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 20px;
}
.modal .modal-search .ico { color: var(--text-secondary); }
.modal .modal-search input { border: 0; background: none; outline: 0; flex: 1; font-family: inherit; font-size: var(--size-body); color: var(--text-primary); }
.modal .modal-search input::placeholder { color: var(--text-secondary); }

.skill-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skill-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; cursor: pointer; transition: border-color var(--transition), background var(--transition);
  display: flex; flex-direction: column; gap: 10px;
}
.skill-card:hover { background: var(--bg-sidebar); }
.skill-card.selected { border: 2px solid var(--primary); background: var(--primary-background); padding: 19px; }
.skill-card .ico { color: var(--primary); }
.skill-card h4 { font-size: var(--size-h4); font-weight: var(--weight-bold); }
.skill-card p { font-size: var(--size-sm); color: var(--text-icon); line-height: 1.55; }
.skill-card .req {
  margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  background: var(--secondary); color: var(--text-icon);
  border-radius: var(--radius); padding: 5px 11px; font-size: var(--size-xs); font-weight: var(--weight-medium);
}
.skill-card .req .ico { color: inherit; }
.skill-card.selected .req { background: var(--primary-background); color: var(--primary); }

/* スキルカードの番号プレフィックス（昇順表示・FCが番号で並び順制御） */
.skill-card h4 .seq { color: var(--text-secondary); font-weight: var(--weight-bold); margin-right: 6px; }
.skill-card.selected h4 .seq { color: var(--primary); }

/* ============================================================
   スキルギャラリー（chat 初期画面＝このテナントでできること）
   レイアウトのみ追加。カードは .skill-card を流用し新規カラーは足さない。
   ============================================================ */
.gallery-head { margin-bottom: 20px; }
.gallery-head h2 { font-size: var(--size-h2); margin-bottom: 8px; }
.gallery-head p { font-size: var(--size-md); color: var(--text-secondary); line-height: 1.6; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }

/* ============================================================
   個社ポータル（chat 初期画面＝よく使うアプリ＋できること の2セクション）
   既存トークン・カードイディオムを流用。新規カラーは足さない。
   ============================================================ */
.portal-section { margin-bottom: 36px; }
.portal-section:last-child { margin-bottom: 0; }
.links-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.link-card {
  display: flex; align-items: center; gap: 13px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; text-decoration: none;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.link-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); border-color: var(--primary); text-decoration: none; }
.link-card .link-ic {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: var(--radius-md);
  background: var(--primary-background); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.link-card .link-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.link-card .link-name { font-size: var(--size-md); font-weight: var(--weight-bold); color: var(--text-primary); display: flex; align-items: center; gap: 6px; }
.link-card .link-name .ext { color: var(--text-secondary); }
.link-card .link-hint { font-size: var(--size-xs); color: var(--text-secondary); line-height: 1.5; }

/* ============================================================
   会話内 AskUserQuestion カード（参照アプリ mock-skills の QuestionCard を移植）
   参照CSSのトークンを CiviLink へマッピング:
     --surface→--bg／--outline→--border／--primary-container→--primary-background／--muted→--text-secondary
   枠 1px solid var(--primary) は維持。assistant 側＝左寄せのカードバブル。
   ============================================================ */
.question-card {
  align-self: flex-start; max-width: 560px;
  display: flex; flex-direction: column; gap: 14px;
  border: 1px solid var(--primary); background: var(--bg);
  border-radius: var(--radius-lg); border-top-left-radius: var(--radius-sm);
  padding: 18px 20px; box-shadow: var(--shadow-1);
}
.question-block { display: flex; flex-direction: column; gap: 8px; }
.question-header {
  align-self: flex-start; font-size: var(--size-2xs); font-weight: var(--weight-bold);
  color: var(--primary); background: var(--primary-background); border-radius: var(--radius-full); padding: 2px 10px;
}
.question-text { font-size: var(--size-md); font-weight: var(--weight-bold); }
.question-options { display: flex; flex-wrap: wrap; gap: 8px; }
.question-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  border: 1px solid var(--border); background: var(--bg); border-radius: var(--radius-md);
  padding: 8px 12px; cursor: pointer; font-family: inherit; font-size: var(--size-sm); color: var(--text-primary);
  transition: border-color var(--transition), background var(--transition);
}
.question-option:hover { border-color: var(--primary); }
.question-option.selected { border-color: var(--primary); background: var(--primary-background); }
.question-option-desc { font-size: var(--size-2xs); color: var(--text-secondary); }
.question-other {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px;
  font-family: inherit; font-size: var(--size-sm); color: var(--text-primary); background: var(--bg); outline: 0;
}
.question-other:focus { border-color: var(--primary); box-shadow: var(--focus-ring-primary); }
.question-other::placeholder { color: var(--text-secondary); }
.question-actions { display: flex; justify-content: flex-end; }
.question-actions .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ============================================================
   管理コンソール
   ============================================================ */
.admin { max-width: 1560px; margin: 0 auto; width: 100%; padding: 24px 40px 48px; }
.admin-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.admin-head h1 { font-size: var(--size-h2); font-weight: var(--weight-bold); }
.admin-head .spacer { flex: 1; }
.admin-head .user { font-size: var(--size-sm); color: var(--text-secondary); }
.admin-head .logout { font-size: var(--size-sm); color: var(--primary); cursor: pointer; }

/* タブ */
.admin-tabs { display: flex; align-items: center; gap: 28px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.admin-tabs .tab { padding: 10px 0; font-size: var(--size-lg); color: var(--text-secondary); cursor: pointer; position: relative; }
.admin-tabs .tab.active { color: var(--text-primary); font-weight: var(--weight-bold); }
.admin-tabs .tab.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 2px; background: var(--primary); }

/* パンくず + 利用量 */
.crumb-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.crumb-row .back { color: var(--primary); cursor: pointer; font-size: var(--size-md); display: inline-flex; align-items: center; gap: 4px; }
.crumb-row .sep { color: var(--text-secondary); }
.crumb-row .here { font-size: var(--size-md); font-weight: var(--weight-bold); color: var(--text-primary); }
.crumb-row .usage { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: var(--size-sm); color: var(--text-secondary); }

.usage-bar { width: 180px; height: 10px; border-radius: var(--radius-full); background: var(--secondary); overflow: hidden; }
.usage-bar > span { display: block; height: 100%; border-radius: var(--radius-full); background: var(--primary); }
.usage-bar.mini { width: 120px; height: 8px; }

/* タイトル行 */
.admin-title { display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; }
.admin-title h2 { font-size: var(--size-h3); font-weight: var(--weight-bold); }
.admin-title .spacer { flex: 1; }
.admin-subnote { font-size: var(--size-sm); color: var(--text-secondary); margin-bottom: 18px; line-height: 1.6; }

/* テナントテーブル */
.tbl { width: 100%; border-collapse: collapse; font-size: var(--size-body); }
.tbl thead th { text-align: left; font-weight: var(--weight-medium); color: var(--text-icon); font-size: var(--size-sm); padding: 11px 14px; background: var(--bg-sidebar); border-bottom: 1px solid var(--border); }
.tbl tbody td { padding: 14px; border-bottom: 1px solid var(--bg-sidebar); color: var(--text-primary); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--bg-hover); }
.tbl .t-name { font-weight: var(--weight-bold); font-size: var(--size-md); }
.tbl .t-slug { font-size: var(--size-xs); color: var(--text-secondary); }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl .muted { color: var(--text-secondary); }
.tbl .row-actions { color: var(--primary); font-size: var(--size-sm); white-space: nowrap; }
.tbl .row-actions span { cursor: pointer; }
.tbl .row-actions .sep { color: var(--border); margin: 0 6px; }

/* スキル編集フォーム */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
.field { margin-bottom: 22px; }
.field > label { display: block; font-size: var(--size-sm); font-weight: var(--weight-medium); color: var(--text-icon); margin-bottom: 8px; }
.field .inp, .field .ta {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px;
  font-family: inherit; font-size: var(--size-md); color: var(--text-primary); background: var(--bg); outline: 0;
}
.field .ta { min-height: 88px; resize: vertical; line-height: 1.55; }
.field .inp:focus, .field .ta:focus { border-color: var(--primary); box-shadow: var(--focus-ring-primary); }
.field .sub { font-size: var(--size-sm); color: var(--text-secondary); margin-top: 8px; }
.field .sub code { background: var(--bg-sidebar); padding: 2px 7px; border-radius: var(--radius-sm); font-size: var(--size-xs); color: var(--text-icon); }

/* ZIP アップロード行 */
.zip-row { display: flex; align-items: center; gap: 12px; background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.zip-row .ico { color: var(--text-icon); }
.zip-row .name { flex: 1; font-size: var(--size-md); color: var(--text-primary); }
.zip-row .zip-badge { width: 22px; height: 22px; border-radius: var(--radius-sm); background: var(--purple); color: #fff; font-size: 8px; font-weight: var(--weight-bold); display: flex; align-items: center; justify-content: center; }

/* SKILL.md プレビューパネル */
.md-panel { background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px 28px; }
.md-panel .md-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.md-panel .md-head .label { font-size: var(--size-lg); font-weight: var(--weight-bold); }
.md-panel .md-head .spacer { flex: 1; }
.md-panel .md-head .tag { background: var(--secondary); color: var(--text-icon); border-radius: var(--radius); padding: 5px 11px; font-size: var(--size-xs); }
.md-panel .md-rule { border: 0; border-top: 1px solid var(--border); margin: 0 0 18px; }
.md-panel h3 { font-size: var(--size-h3); font-weight: var(--weight-bold); margin-bottom: 10px; }
.md-panel .md-divider { border: 0; border-top: 1px solid var(--border); margin: 0 0 16px; }
.md-panel .md-sec { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; }
.md-panel .md-sec::before { content: ''; width: 4px; height: 20px; border-radius: 2px; background: var(--primary); }
.md-panel .md-sec b { font-size: var(--size-lg); font-weight: var(--weight-bold); }
.md-panel ul { margin: 0; padding-left: 20px; }
.md-panel li { font-size: var(--size-sm); color: var(--text-icon); line-height: 1.7; }
.md-panel .files-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; margin-top: 6px; }
.md-panel .files-box .frow { font-size: var(--size-sm); color: var(--text-icon); line-height: 1.9; }
.md-panel .files-box .frow code { color: var(--primary); }

/* admin フッター注記 */
.admin-foot { font-size: var(--size-sm); color: var(--text-secondary); margin-top: 24px; line-height: 1.6; }

/* 上限・管理者バッジ */
.badge-lock { display: inline-flex; align-items: center; gap: 7px; background: var(--secondary); color: var(--text-icon); border-radius: var(--radius-full); padding: 5px 14px; font-size: var(--size-sm); }
.badge-lock .ico { color: var(--text-icon); }

/* ============================================================
   テナント詳細ドリルダウン（左サブナビ＋右ペインの2カラム）
   計画 §4「左サブナビ＋右ペインの2カラム」を正本とし、chat 横並びタブではなく
   縦サブナビで実装。既存トークン・カードイディオムを流用し新規カラーは足さない。
   ペインは .detail-pane をグローバル [hidden] でトグル（サイドバー専用ルールに結合しない）。
   ============================================================ */
.tenant-detail { display: grid; grid-template-columns: 236px 1fr; gap: 32px; align-items: start; margin-top: 10px; }
.detail-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; }
.detail-nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 11px 14px; border: 0; background: transparent; border-radius: var(--radius);
  font-family: inherit; font-size: var(--size-md); color: var(--text-primary);
  cursor: pointer; transition: background var(--transition);
}
.detail-nav-item:hover { background: var(--bg-hover); }
.detail-nav-item.active { background: var(--primary-background); color: var(--primary); font-weight: var(--weight-bold); }
.detail-nav-item .ico { color: var(--text-icon); }
.detail-nav-item.active .ico { color: var(--primary); }
.detail-main { min-width: 0; }
.detail-pane { min-width: 0; }

/* ペイン内の縦フォーム（参考 EditTenantModal 等の項目を縦積み・表示のみ） */
.pane-form { max-width: 560px; }
.pane-form .field .inp, .pane-form .field .ta { width: 100%; }
.pane-actions { display: flex; gap: 10px; margin-top: 6px; }
.radio-row { display: flex; flex-direction: column; gap: 10px; }
.radio-row .radio { display: flex; align-items: center; gap: 8px; font-size: var(--size-md); color: var(--text-primary); cursor: pointer; }

/* スキル管理サブタブ（スキル一覧／基本ロジック）＝chat の .side-tabs を流用しつつ admin 内で余白調整 */
.subtabs { margin: 6px 0 18px; }

/* スキル一覧・ユーザー一覧は行クリックを持たない（テナント一覧と違い誤クリックを誘発しない） */
.skills-tbl tbody tr, .users-tbl tbody tr { cursor: default; }
.skills-tbl tbody tr:hover td, .users-tbl tbody tr:hover td { background: transparent; }

/* ユーザー追加行（メール入力＋追加ボタン） */
.user-add { display: flex; gap: 10px; max-width: 560px; margin-bottom: 16px; }
.user-add input {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px;
  font-family: inherit; font-size: var(--size-md); color: var(--text-primary); background: var(--bg); outline: 0;
}
.user-add input:focus { border-color: var(--primary); box-shadow: var(--focus-ring-primary); }

/* 代表テナント以外の行内アクション（接続先を持たない＝注記に寄せる） */
.tbl .row-actions.muted-actions span { color: var(--text-secondary); cursor: default; }

/* BOX連携：他ストレージ拡張枠（将来対応・disabled 表示） */
.storage-ext { display: flex; flex-direction: column; gap: 8px; max-width: 560px; margin-top: 4px; }
.storage-row { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; }
.storage-row.disabled { opacity: .6; }
.storage-row .s-ic { display: flex; color: var(--text-icon); }
.storage-row .s-name { flex: 1; font-size: var(--size-md); color: var(--text-primary); }

/* 無効ユーザー／将来対応の中立 pill（既存 .pill.* に追加） */
.pill.off { background: var(--secondary); color: var(--text-icon); }

/* テナント別リンク設定（代表画面・localStorage 永続化）。既存 form/table イディオムを流用。
   列＝アイコン画像／表示名／リンク先URL／副題（hint）／削除 の5カラム。 */
.link-settings { display: flex; flex-direction: column; gap: 10px; max-width: 1040px; margin-top: 4px; }
.link-settings-head, .link-row { display: grid; grid-template-columns: 200px 1fr 1.3fr 1fr 44px; gap: 14px; align-items: center; }
.link-settings-head { font-size: var(--size-sm); font-weight: var(--weight-medium); color: var(--text-icon); padding: 0 2px 4px; }
.link-row .link-icon-cell { display: flex; align-items: center; gap: 10px; }
.link-row .icon-ph { width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--radius-md); background: var(--primary-background); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.link-row .link-icon-cell .btn { padding: 8px 12px; font-size: var(--size-sm); white-space: nowrap; }
.link-row input { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-family: inherit; font-size: var(--size-md); color: var(--text-primary); background: var(--bg); outline: 0; }
.link-row input:focus { border-color: var(--primary); box-shadow: var(--focus-ring-primary); }
.link-row .btn.ghost { padding: 8px; }
/* 保存フィードバック（confirm/alert 不使用の軽い通知）。テキストは可読色、チェックアイコンで success を表現 */
.save-flash { font-size: var(--size-sm); color: var(--text-primary); font-weight: var(--weight-medium); display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; }
.save-flash .ico { color: var(--success); }
.save-flash[hidden] { display: none; }

/* ============================================================
   ランディング（index.html）
   ============================================================ */
.landing { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; background: var(--bg-sidebar); }
.landing .hero { text-align: center; margin-bottom: 40px; }
.landing .hero img { margin-bottom: 20px; }
.landing .hero h1 { font-size: var(--size-h1); margin-bottom: 12px; }
.landing .hero p { font-size: var(--size-lg); color: var(--text-icon); line-height: 1.7; }
.landing .cards { display: grid; grid-template-columns: repeat(2, 320px); gap: 20px; }
.landing-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px; text-decoration: none; transition: box-shadow var(--transition), transform var(--transition);
  display: flex; flex-direction: column; gap: 12px;
}
.landing-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); text-decoration: none; }
.landing-card .ic { width: 52px; height: 52px; border-radius: var(--radius-md); background: var(--primary-background); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.landing-card h2 { font-size: var(--size-h3); }
.landing-card p { font-size: var(--size-sm); color: var(--text-icon); line-height: 1.6; }
.landing-card .states { font-size: var(--size-xs); color: var(--text-secondary); }
.landing .note { margin-top: 36px; font-size: var(--size-xs); color: var(--text-secondary); text-align: center; max-width: 560px; line-height: 1.7; }
