/* ミカタFAQ 管理画面 (デザインはミカタVR準拠: 白ロゴブロック+赤ヘッダ+黒サイドバー+白カード) */
:root {
  --bg: #F4F4F4;
  --panel: #FFFFFF;
  --ink: #222222;
  --muted: #6E6E6E;
  --line: #E3E3E3;
  --accent: #C0392B;       /* ミカタレッド(シリーズ標準 MIKATA_DESIGN.md) */
  --accent-soft: #FDEDEC;
  --warn: #B45309;         /* 注意はアンバー(赤=ブランド色と区別する) */
  --warn-soft: #FCEEDF;
  --side-bg: #141414;      /* ロゴブロック・サイドバーの黒 */
}
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: 15px;
  line-height: 1.7;
}
a { color: var(--accent); }

/* --- ヘッダ(全幅・白): ロゴ + 赤い縦棒つきページ名 (ミカタノート準拠) --- */
.topbar {
  display: flex; align-items: center;
  background: #fff; border-bottom: 1px solid var(--line); min-height: 60px;
  /* スクロールしても画面上部に固定(スマホは末尾の@mediaで解除) */
  position: sticky; top: 0; z-index: 950;
}
.logo {
  flex: none; width: 220px;
  display: flex; align-items: center; justify-content: flex-start; padding: 0 24px;
}
.logo-full { display: block; width: 100%; height: auto; }
.logo-icon { display: none; width: 34px; height: auto; }
.logo-mark { color: var(--accent); font-size: 20px; line-height: 1; } /* ログイン・セットアップ画面の文字ロゴ用 */
.topbar-inner {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px 0 4px;
}
.topbar-title {
  margin: 0; min-width: 0;
  font-size: 18px; font-weight: 700; line-height: 1.3; letter-spacing: .01em;
  border-left: 4px solid var(--accent); padding-left: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
/* ハンバーガー(スマホだけ表示。ドロワーを開く) */
.menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none; margin-left: 4px;
  background: none; border: none; border-radius: 5px; color: var(--ink); cursor: pointer; padding: 0;
}
.menu-btn:hover { background: var(--bg); }
/* ヘッダ右上のボタン。<a> と <button> が混ざるので、高さは指定して揃える。
   余白まかせにすると、<button> だけ行の高さの扱いが違って2px低くなる
   (2026-09-28にのざきさんが画面で発見。ボタン32px / リンク34.1px だった) */
.tb-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 14px;
  color: var(--accent); border: 1px solid var(--accent); border-radius: 5px; background: #fff;
  font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1;
  text-decoration: none; white-space: nowrap;
}
.tb-btn:hover { background: var(--accent-soft); }
.tb-btn.on { background: var(--accent); color: #fff; }
/* 歯車だけのボタン(ラベルを持たないので左右の余白を詰める) */
.tb-btn.tb-icon { padding: 0 9px; }
.tb-btn.tb-icon svg { width: 18px; height: 18px; display: block; }

/* --- ヘッダ右上: ユーザーメニュー(丸アイコン+プルダウン) --- */
.user-menu { position: relative; display: flex; align-items: center; }
/* 丸いアイコンだが、同じ列に並ぶので高さは .tb-btn(34px)に合わせる */
.user-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: none; border: none; color: var(--muted); cursor: pointer; padding: 0;
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--bg); color: var(--ink); }
.user-pop {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 900;
  min-width: 210px; background: var(--panel); border-radius: 5px;
  box-shadow: 0 10px 32px rgba(0,0,0,.22); padding: 6px;
}
.user-pop-head { padding: 10px 12px 9px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-pop-name { display: block; font-weight: 700; font-size: 14px; color: var(--ink); }
.user-pop-id { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.user-pop-item {
  display: block; width: 100%; text-align: left; padding: 8px 12px;
  font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none;
  background: none; border: none; border-radius: 5px; cursor: pointer;
  font-family: inherit; line-height: 1.7;
}
.user-pop-item:hover { background: var(--bg); }

/* パスワード入力欄: 目のマークで表示/非表示切替 */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 42px; }
.pw-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 5px;
  background: none; border: none; cursor: pointer; color: var(--muted); padding: 0;
}
.pw-eye:hover { color: var(--ink); background: var(--bg); }
.pw-eye svg[hidden] { display: none; } /* SVGはhidden属性だけでは消えないため明示する */

.shell { display: flex; min-height: calc(100vh - 60px); }

/* --- sidebar (赤背景・アイコンつき・ミカタノート準拠) --- */
.side {
  width: 220px; flex: none;
  background: var(--accent); color: #fff;
  display: flex; flex-direction: column;
  padding: 12px 0 0;
  /* ヘッダの下に固定(本文だけがスクロールする)。メニューが画面より長いときはサイドバー内でスクロール */
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto;
}
/* いま入っているサイト名(サイト内モードのときだけ表示) */
.side-site { position: relative; padding: 8px 20px 14px; margin-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,.3); }
.side-site-label { display: block; font-size: 11px; font-weight: 600; color: rgba(255,255,255,.75); }
/* 鉛筆マークのぶん右を空ける(長い名前が重ならないように) */
.side-site-name { display: block; font-size: 15px; font-weight: 700; line-height: 1.4; padding-right: 26px; }
/* サイト名の変更ボタン。名前が出ている場所から直せるようにするための入口 */
.side-site-edit {
  position: absolute; top: 24px; right: 14px;
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  background: none; border: 0; border-radius: 5px;
  color: rgba(255,255,255,.8); cursor: pointer;
}
.side-site-edit svg { width: 16px; height: 16px; }
.side-site-edit:hover { background: rgba(255,255,255,.18); color: #fff; }
.side-site-edit:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
/* ユーザー変更モーダル: 削除だけ左端に離す(「変更する」の隣だと押し間違える) */
.ue-actions .ue-spacer { flex: 1; }
.side nav { display: flex; flex-direction: column; }
.side-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 11px 20px;
  color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; line-height: 1.4;
  background: none; border: none; text-align: left; cursor: pointer; font-family: inherit;
}
.side-item svg { flex: none; }
.side-item:hover { background: rgba(255,255,255,.14); }
.side nav .side-item.on { background: #fff; color: var(--accent); }
.s-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 下端グループ: 「サイト一覧に戻る」+罫線+「閉じる」(画面下に固定) */
.side-bottom {
  margin-top: auto; position: sticky; bottom: 0;
  background: var(--accent);
  padding: 6px 0 10px;
}
.side-toggle { border-top: 1px solid rgba(255,255,255,.3); padding-top: 12px; }
/* ヘッダの操作ボタンのドロワー版(スマホだけ表示) */
.side nav.side-mobile-actions { display: none; margin-top: 10px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.3); }
/* ドロワーの後ろの薄暗い幕(スマホだけ使う) */
.side-backdrop { display: none; position: fixed; inset: 0; z-index: 1090; background: rgba(20,20,20,.45); }

/* --- サイドバーを閉じた状態(アイコンだけの細い帯) --- */
body.side-closed .side { width: 64px; }
body.side-closed .side .s-label, body.side-closed .side-site { display: none; }
body.side-closed .side-item { justify-content: center; padding-left: 0; padding-right: 0; }
body.side-closed .logo { width: 64px; padding: 0; justify-content: center; }
body.side-closed .logo-full { display: none; }
body.side-closed .logo-icon { display: block; }
body.side-closed .side-toggle svg { transform: rotate(180deg); }

/* --- main --- */
/* 文字の役割は4階層: ページ見出し(h1・大) > セクション見出し(h2・アクセント棒) > 本文 > ラベル・補足(小・薄) */
.main { flex: 1; padding: 28px 40px 60px; max-width: 1040px; }
/* ページ見出しはヘッダ(.topbar-title)に出す。本文先頭の説明文はここから始まる */
.page-desc { font-size: 13px; color: var(--muted); margin: 0 0 24px; }
.main h2 {
  font-size: 17px; font-weight: 700; margin: 32px 0 14px;
  padding-left: 10px; border-left: 4px solid var(--accent); line-height: 1.4;
}
/* カードの先頭の見出し。.main h2 の上の余白(32px)に負けないよう、同じ強さで0にする */
.panel-title, .main h2.panel-title, .main h3.panel-title { margin-top: 0; }
.panel-title-sub { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 8px; }
.sec-title {
  font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: 0;
  padding-left: 10px; border-left: 4px solid var(--accent); line-height: 1.4; margin: 32px 0 14px;
}
.sec-title:first-child { margin-top: 0; }
/* カードの中の小見出し(h3)は、セクション見出しより一段小さく */
.main h3 { font-size: 15px; font-weight: 700; margin: 0 0 10px; }
h3.sec-title { font-size: 15px; margin: 24px 0 10px; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 5px;
  padding: 20px 24px; margin-bottom: 20px;
}

/* 一覧の横スクロール容器(admin.jsが全テーブルを自動で包む。狭い画面で列が潰れないように) */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .05em;
  background: #F6F8F9; border-bottom: 2px solid var(--line); white-space: nowrap;
}
tbody td > a { font-weight: 600; text-decoration: none; color: var(--ink); }
tbody td > a:hover { text-decoration: underline; color: var(--accent); }
td .sub { color: var(--muted); font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pub-label { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 3px; margin-left: 6px; vertical-align: middle; }
.pub-on { background: rgba(192,57,43,0.5); color: #fff; }
.pub-off { background: #fff; color: rgba(192,57,43,0.5); border: 1px solid rgba(192,57,43,0.5); }
.stale-on { background: var(--warn); color: #fff; }
.idx-on { background: rgba(39,174,96,0.5); color: #fff; }
.idx-off { background: #fff; color: #999; border: 1px solid #DDD; }

.code-box {
  background: #F6F8F9; border: 1px solid var(--line); border-radius: 5px;
  padding: 12px; overflow-x: auto; font-size: 12px; margin: 4px 0 0;
}
.field-label { display: block; font-size: 14px; font-weight: 700; color: var(--ink); }

/* --- forms --- */
label.field, div.field { display: block; margin-bottom: 16px; }
label.field > span, div.field > span:first-child { display: block; font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.field-inline { display: flex; align-items: baseline; gap: 8px; margin: 0 0 16px; }
.field-inline-label { font-size: 14px; font-weight: 700; color: var(--ink); }
.field-inline-code { background: var(--bg); padding: 2px 8px; border-radius: 4px; font-size: 13px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], textarea, select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px;
  font: inherit; background: #fff;
}
input:focus:not([type=radio]):not([type=checkbox]), textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 160px; }

/* 色の欄(settings.php の color_field): 固定の色＋自由に選ぶ＋HEX＋RGB を並べて出す */
.color-swatches { display: grid; grid-template-columns: repeat(10, 28px); gap: 6px; margin-bottom: 10px; }
.color-swatch {
  width: 28px; height: 28px; padding: 0; border: 2px solid #fff; border-radius: 5px; cursor: pointer;
  box-shadow: 0 0 0 1px var(--line);
}
.color-swatch:hover { box-shadow: 0 0 0 1px #999; }
.color-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.color-swatch:disabled { cursor: default; }
.color-inputs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.color-free, .color-in { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.color-free { cursor: pointer; }
.color-picker { width: 40px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 5px; background: #fff; cursor: pointer; }
.color-in input[type=text] { width: 100px; font-family: ui-monospace, Menlo, monospace; }
.color-in input[type=number] { width: 70px; }

.btn {
  display: inline-block; padding: 8px 20px; border: none; border-radius: 5px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
/* display指定はhidden属性に勝ってしまうので打ち消す。
   これが無いと hidden を付けたボタンが出たままになる(2026-09-28に実際に起きた) */
.btn[hidden] { display: none; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.danger { background: transparent; color: var(--warn); border: 1px solid var(--warn); }
.btn.sm { padding: 4px 12px; font-size: 13px; font-weight: 500; }
.btn.xs { padding: 3px 10px; font-size: 12px; font-weight: 500; }

/* 保存・キャンセルの右寄せ行 */
/* --- トグルスイッチ --- */
.toggle { display:inline-flex; align-items:center; gap:8px; cursor:pointer; font-weight:normal; }
.toggle input { display:none; }
.toggle-track { position:relative; width:40px; height:22px; background:#CCC; border-radius:11px; transition:background .2s; flex-shrink:0; }
.toggle-track::after { content:''; position:absolute; top:2px; left:2px; width:18px; height:18px; background:#fff; border-radius:50%; transition:transform .2s; box-shadow:0 1px 2px rgba(0,0,0,.15); }
.toggle input:checked + .toggle-track { background:var(--accent); }
.toggle input:checked + .toggle-track::after { transform:translateX(18px); }

.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.form-actions .btn { min-width: 120px; text-align: center; }

.filter-grid {
  display: grid; grid-template-columns: auto 1fr; gap: 8px 16px;
  align-items: center; margin-bottom: 16px;
}
.filter-label { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.filter-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }

/* --- chips / badges --- */
.chip {
  display: inline-block; padding: 1px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; margin: 0 4px 4px 0;
}
.badge-off { display: inline-block; padding: 1px 8px; border-radius: 4px; background: #EEE; color: var(--muted); font-size: 12px; }
.chip.zero { background: var(--warn-soft); color: var(--warn); }

/* --- パネル内「もっと見る」ボタン行 --- */
.panel-more { text-align: right; margin-top: auto; padding-top: 12px; }

/* --- 戻るリンク(詳細ページ上部) --- */
.back-link { display: block; font-size: 13px; font-weight: 600; text-decoration: none; margin-bottom: 16px; }
.back-link:hover { text-decoration: underline; }

/* --- stat bars (見られ方) --- */
.bar-row { display: grid; grid-template-columns: 1fr 90px; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bar-label { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { grid-column: 1 / -1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.bar-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

/* --- login --- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 20px; }
.login-box { width: 340px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 32px; }
.login-logo { text-align: center; margin: 0 0 20px; }
.login-logo img { display: inline-block; }
.login-subtitle { font-size: 15px; font-weight: 700; margin: -10px 0 20px; text-align: center; color: var(--muted); }
.login-box h1 { font-size: 20px; margin: 0 0 20px; }
.login-box h1::after { content: ""; display: block; width: 28px; height: 3px; background: var(--accent); margin-top: 8px; border-radius: 2px; }
.login-box h1.login-subtitle::after { display: none; }
.error { color: var(--accent); background: var(--accent-soft); border-radius: 5px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }
.notice { color: #157F3C; background: #E8F7EE; border-radius: 5px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }
/* 注意(エラーではないが、気づいて対応してほしいこと)。ブランド赤と区別するためアンバー */
.caution { color: var(--warn); background: var(--warn-soft); border: 1px solid #F0CFC6; border-radius: 5px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }

/* システム設定: メールのテスト送信(同じパネルの中の、保存とは別の操作なので罫線で区切る) */
.mail-test { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.mail-test-title { font-weight: 700; font-size: 14px; margin: 0 0 8px; }
.mail-test-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mail-test-row input { flex: 1; min-width: 220px; max-width: 360px; margin: 0; }

/* 行のどこを押しても開ける一覧(data-href を持つ行。動きは admin.js)。押せることが分かるよう色を変える */
tr[data-href] { cursor: pointer; }
tr[data-href]:hover > td { background: #FAFAFA; }

/* --- フッタ(右カラム下に固定) --- */
.admin-footer {
  position: fixed; bottom: 0; left: 220px; right: 0;
  padding: 10px 0; font-size: 12px; color: #8E99A4; letter-spacing: .02em;
  text-align: center; background: var(--bg);
  border-top: 1px solid var(--line);
}
.admin-footer-sep { margin: 0 10px; color: #C0C6CC; }
body.side-closed .admin-footer { left: 64px; }

/* --- ブロックエディタ --- */
#block-editor { border: 1px solid var(--line); border-radius: 5px; padding: 12px; background: #FAFBFC; }
.be-block { background: var(--panel); border: 1px solid var(--line); border-radius: 5px; margin-bottom: 10px; }
.be-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--line); background: #F6F8F9; border-radius: 5px 5px 0 0; }
.be-type { font-size: 12px; color: var(--muted); font-weight: 600; }
.be-ctrl { display: flex; gap: 4px; }
.be-ctrl-btn { border: 1px solid var(--line); background: #fff; border-radius: 4px; width: 26px; height: 24px; cursor: pointer; font-size: 12px; color: var(--muted); }
.be-ctrl-btn:hover:not(:disabled) { color: var(--ink); border-color: var(--muted); }
.be-ctrl-btn:disabled { opacity: .3; cursor: default; }
.be-body { padding: 10px 12px; }
.be-body textarea { min-height: 72px; resize: none; overflow: hidden; }
.be-toolbar { display: flex; gap: 6px; margin-bottom: 6px; }
.be-tool { border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 2px 10px; font-size: 12px; cursor: pointer; color: var(--muted); }
.be-tool:hover { color: var(--ink); border-color: var(--muted); }
.be-callout-style { margin-bottom: 8px; max-width: 160px; }
.be-img { margin-bottom: 8px; }
.be-img img { max-width: min(320px, 100%); max-height: 200px; border-radius: 5px; border: 1px solid var(--line); }
.be-img-empty { color: var(--muted); font-size: 13px; }
.be-body input[type=text] { margin-top: 6px; }
.be-add { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.be-add-btn { border: 1px dashed var(--muted); background: transparent; border-radius: 5px; padding: 6px 14px; font-size: 13px; cursor: pointer; color: var(--muted); }
.be-add-btn:hover { color: var(--accent); border-color: var(--accent); }

/* --- 月次レポート一覧 --- */
.report-list { display: flex; flex-direction: column; gap: 12px; }
.report-card { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.report-card-head { flex: 0 0 140px; }
.report-card-month { display: block; font-size: 17px; font-weight: 700; }
.report-card-date { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.report-card-stats { flex: 1; display: flex; gap: 24px; min-width: 0; }
.report-card-stat { display: flex; align-items: baseline; gap: 6px; }
.report-card-num { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.report-card-num small { font-size: 14px; }
.report-card-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.report-card-trend { font-size: 11px; font-weight: 700; }
.report-card-trend.up { color: #157F3C; }
.report-card-trend.down { color: var(--warn); }
.report-card-action { flex: none; }

/* --- 月次レポート詳細: サマリーカード --- */
.rpt-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px;
  margin-bottom: 20px;
}
.rpt-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 5px;
  padding: 16px 18px; text-align: center;
}
.rpt-card-num { display: block; font-size: 28px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.rpt-card-num small { font-size: 18px; font-weight: 700; }
.rpt-card-label { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.rpt-card-trend { display: block; font-size: 12px; font-weight: 700; margin-top: 4px; }
.rpt-card-trend.up { color: #157F3C; }
/* 月次レポート: その月の要点検をどの基準で数えたか(数字カードのすぐ下。あとで設定を変えても見返せるように) */
.rpt-criteria { font-size: 12px; color: var(--muted); margin: -8px 0 20px; }
.rpt-card-trend.down { color: var(--warn); }

/* --- 月次レポート詳細: 棒グラフ --- */
.rpt-bar-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.rpt-bar-row:last-child { border-bottom: none; }
.rpt-bar-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpt-bar-right { display: flex; align-items: center; gap: 10px; }
.rpt-bar-track { flex: 1; height: 18px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.rpt-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s ease; }
.rpt-bar-num { flex: none; width: 60px; text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rpt-bar-trend { flex: none; width: 50px; font-size: 11px; font-weight: 700; }
.rpt-bar-trend.up { color: #157F3C; }
.rpt-bar-trend.down { color: var(--warn); }

/* --- 月次レポート詳細: 0件検索ワード --- */
.rpt-zero-list { display: flex; flex-wrap: wrap; gap: 8px; }
.rpt-zero-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--warn-soft); border: 1px solid #F0CFC6; border-radius: 5px;
  padding: 6px 14px;
}
.rpt-zero-word { font-weight: 700; font-size: 14px; }
.rpt-zero-count { font-size: 11px; color: var(--warn); font-weight: 600; }

/* --- 月次レポート本文 --- */
.report-body h2 { font-size: 18px; margin: 24px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--accent); }
.report-body h3 { font-size: 15px; margin: 20px 0 6px; }
.report-body h4 { font-size: 14px; margin: 16px 0 4px; color: var(--muted); }
.report-body ul { margin: 6px 0; padding-left: 22px; }
.report-body p { margin: 6px 0; }

/* レポート本文の表(AIが生成したMarkdownの表をHTMLの表にしたもの) */
.rpt-table-wrap { overflow-x: auto; margin: 10px 0 14px; }
.report-body .rpt-table { border-collapse: collapse; width: auto; min-width: min(420px, 100%); font-size: 13px; }
.report-body .rpt-table th,
.report-body .rpt-table td { border: 1px solid var(--line); padding: 6px 12px; text-align: left; vertical-align: top; }
.report-body .rpt-table th { background: var(--bg); font-weight: 600; white-space: nowrap; }
.report-body .rpt-table tbody tr:nth-child(even) td { background: #FAFBFC; }

/* --- ドラッグ&ドロップ --- */
.drag-handle { cursor: grab; color: #B0BCC2; font-size: 16px; user-select: none; touch-action: none; padding: 2px 6px; display: inline-block; }
.drag-handle:hover { color: var(--accent); }
.drag-cell { width: 36px; min-width: 36px; max-width: 36px; }

/* 置き場所プレースホルダ(ドラッグ中、元の位置に薄く残る) */
tr.dragging, .be-block.dragging {
  opacity: .35;
  background: var(--accent-soft);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}
tr.dragging td, .be-block.dragging > * { visibility: hidden; } /* 中身は消して「枠」だけ見せる */

/* カーソルに追従する浮いた分身 */
.drag-ghost {
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  opacity: .97;
  transition: box-shadow .15s ease, transform .15s ease, top .12s ease, left .12s ease;
  overflow: hidden;
}
.drag-ghost.lifted {
  transition: box-shadow .15s ease, transform .15s ease; /* 追従中はtopをアニメさせない */
  box-shadow: 0 14px 32px rgba(0,0,0,.24), 0 3px 8px rgba(0,0,0,.12);
  transform: scale(1.015) rotate(.4deg);
}
.drag-ghost td { border-bottom: none; background: #fff; }

/* 置いた直後にふわっと馴染む */
tr.drag-settled, .be-block.drag-settled { animation: drag-settle .4s ease; }
@keyframes drag-settle {
  from { background: var(--accent-soft); }
  to   { background: transparent; }
}

body.drag-active { user-select: none; cursor: grabbing; }
body.drag-active .drag-handle { cursor: grabbing; }
.sortable-table tbody tr { transition: background .12s; }

/* --- トースト通知 --- */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 5px; font-size: 13px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); opacity: 0; transform: translateY(8px);
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: var(--accent); }

/* --- サイト一覧(玄関): サイトカード --- */
.site-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.site-card {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 20px;
}
.site-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.site-card-head-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.site-card-name { font-size: 17px; font-weight: 700; line-height: 1.4; }
.site-card-key {
  font-size: 11px; color: var(--muted); background: var(--bg);
  border-radius: 4px; padding: 1px 8px; white-space: nowrap;
  /* 親が縦並びのflexなので、指定しないとサイト名と同じ幅まで灰色が伸びる。サイトキーの文字数に合わせる */
  align-self: flex-start;
}
.site-card-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0;
}
.mini-stat { text-align: center; }
.mini-stat + .mini-stat { border-left: 1px solid var(--line); }
.mini-num { display: block; font-size: 20px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.mini-label { display: block; font-size: 11px; color: var(--muted); }
.mini-stat.warn .mini-num { color: var(--warn); }
.site-pub-form { margin: 0; }
.site-pub-toggle { font-size: 13px; }
.site-pub-toggle input:not(:checked) ~ .site-pub-label { color: var(--muted); }
.site-pub-toggle input:disabled ~ .toggle-track { cursor: default; opacity: .6; }
.site-card-flags { min-height: 24px; }
.site-card-bottom { margin-top: auto; display: flex; align-items: center; gap: 14px; }
.site-card-enter { flex: 1; text-align: center; }
.site-card-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.site-copy-btn, .site-del-btn {
  font: inherit; font-size: 12px; color: var(--muted); background: none; border: 1px solid var(--line);
  border-radius: 4px; padding: 2px 10px; cursor: pointer; white-space: nowrap; line-height: 1.5;
}
.site-copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.site-del-btn { background: var(--accent); border-color: var(--accent); color: #fff; }
.site-del-btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.site-card-add {
  align-items: center; justify-content: center; gap: 6px;
  border-style: dashed; border-color: #BDBDBD; background: transparent; color: var(--muted);
  text-decoration: none; font: inherit; font-weight: 600; min-height: 160px; cursor: pointer;
}
.site-card-add:hover { color: var(--accent); border-color: var(--accent); }
.site-card-add-plus { font-size: 28px; line-height: 1; }

/* 一覧(表)の最後に置く「追加」ボタン。サイト一覧の追加カードと同じ点線スタイルの横長版 */
.list-add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 14px; padding: 13px;
  border: 1px dashed #BDBDBD; border-radius: 5px;
  background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; cursor: pointer;
}
.list-add:hover { color: var(--accent); border-color: var(--accent); }
.list-add-plus { font-size: 22px; line-height: 1; }

/* 許可するサイトのドメイン(1行1つ+削除。埋め込みサイト設定) */
.domain-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.domain-row input { flex: 1; min-width: 0; }
.domain-row .btn { flex: none; }
#domain-list + template + .list-add, #domain-list + .list-add { margin-top: 4px; }

/* 埋め込みタグの下の「貼り方」(埋め込みサイト設定) */
.embed-howto { margin-top: 14px; padding: 12px 16px; background: var(--bg); border-radius: 5px; font-size: 14px; }
.embed-howto-title { font-weight: 700; margin-bottom: 6px; }
.embed-howto ol { margin: 0; padding-left: 1.4em; }
.embed-howto li { margin: 4px 0; line-height: 1.7; }
.embed-howto code { background: #fff; padding: 1px 6px; border-radius: 3px; font-size: 13px; }
/* 埋め込みの見た目(タグの枠の中。4つのプルダウンを2列に) */
.embed-layout { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line, #E5E5E5); }
.embed-layout .sec-title { margin-top: 0; }
.embed-layout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }

/* --- モーダル(サイトを追加) --- */
.modal-back {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(28, 38, 43, .45);
  display: grid; place-items: center; padding: 20px;
}
.modal-back[hidden] { display: none; } /* display:gridがhidden属性に勝ってしまうのを防ぐ */
.modal {
  width: 100%; max-width: 440px;
  background: var(--panel); border-radius: 5px; padding: 24px 28px;
  box-shadow: 0 18px 48px rgba(0,0,0,.28);
}
.modal-title { margin: 0 0 16px; font-size: 17px; font-weight: 700; padding: 0; border: none; }
/* 検索キーワードモーダルの2カラム(スマホでは縦積みになる) */
.kw-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.main .modal-title { border-left: none; padding-left: 0; }
.modal-note { font-size: 12px; color: var(--muted); margin: 0 0 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
/* プレビューの選択(埋め込み / 独立サイト)。使えないほうは押せなくする */
.prev-choice { display: flex; gap: 10px; margin-bottom: 14px; }
.prev-choice .btn { flex: 1; }
.prev-choice .btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

/* --- サイトダッシュボード: 数字カード(押すと各画面へ) --- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px;
  margin-bottom: 8px;
}
a.stat { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.stat:hover { border-color: var(--accent); box-shadow: 0 1px 6px rgba(0,0,0,.07); }
.stat {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 5px; padding: 14px 18px;
}
.stat-num { display: block; font-size: 26px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-unit { font-size: 15px; font-weight: 700; margin-left: 1px; }
.stat-none { color: var(--muted); font-weight: 400; }
.stat-label { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.stat.warn { background: var(--warn-soft); border-color: #F0CFC6; }
.stat.warn .stat-num { color: var(--warn); }

/* --- サイトダッシュボード: 今やること --- */
.todo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.todo-panel { margin-bottom: 0; display: flex; flex-direction: column; }
.todo-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; margin: 0 0 8px; }
.todo-count {
  font-size: 11px; font-weight: 700; padding: 1px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.todo-count.warn { background: var(--warn-soft); color: var(--warn); }
.todo-desc { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
/* レポートが作られていない月がある、の知らせ。ブランド赤と区別するためアンバー */
.todo-warn {
  font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-soft);
  border-radius: 5px; padding: 6px 10px; margin: 0 0 10px;
}
/* 月次レポートの数字(前月比つき)。他のカードの一覧と高さを揃える */
.rep-mini { margin: 0; }
.rep-mini > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.rep-mini dt { font-size: 12px; color: var(--muted); }
.rep-mini dd { margin: 0; font-size: 14px; font-weight: 700; }
.rep-mini dd .report-card-trend { margin-left: 6px; font-weight: 700; }
/* レポート本文の書き出し1行。読み物の予告編として本文より小さく */
.rep-line { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 10px 0 0; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px;
}
.todo-list li a { flex: 1; font-weight: 600; text-decoration: none; color: var(--ink); }
.todo-list li a:hover { text-decoration: underline; color: var(--accent); }
.todo-word { flex: 1; font-weight: 600; }
.todo-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.todo-more { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 600; text-decoration: none; }
.todo-more:hover { text-decoration: underline; }
.todo-empty { font-size: 13px; color: var(--muted); margin: 4px 0 0; }

/* --- 掲載の並び: 追加行 --- */
.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row select { max-width: 420px; }

/* --- 編集画面: エディタ+プレビューの2カラム --- */
.edit-split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 16px; align-items: start; }
@media (max-width: 1100px) { .edit-split { grid-template-columns: 1fr; } }
.preview-col { position: sticky; top: 76px; } /* 固定ヘッダ(60px)の下に付く */
.preview-pane { border: 1px solid var(--line); border-radius: 5px; background: #fff; padding: 16px 20px; }
.pv-badge { display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 1.7em; height: 1.7em; border-radius: 50%; margin: .1em .7em 0 0; align-self: flex-start;
  color: #fff; font-weight: 700; font-size: .82em; }
/* ↑ 大きさ・余白・文字色は、お客さんに見える側(widget/faq-widget.js の .fqw-q::before / .fqw-ans::before)と同じ値にする。
   プレビューは「公開したらこう見える」を示すものなので、ここだけ違う値にしない */
.pv-q { display: flex; align-items: baseline; font-weight: 700; color: #222; line-height: 1.6;
  padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.pv-a { padding: .5em 0 0; font-size: .94em; line-height: 1.7; }
.pv-q .pv-badge { background: var(--pv-accent, #0E7C7B); }
.pv-ans .pv-badge { background: var(--pv-sub-accent, var(--pv-accent, #0E7C7B)); }
.pv-ans { display: flex; align-items: baseline; background: color-mix(in srgb, var(--pv-sub-accent, var(--pv-accent, #0E7C7B)) 8%, #fff); border-radius: 8px; padding: .7em; margin: 0 -.25em; }
.pv-atext { flex: 1; min-width: 0; color: #333; }
.pv-atext > :first-child { margin-top: 0; }
.pv-atext > :last-child { margin-bottom: 0; }
.pv-atext p { margin: .5em 0; }
.pv-atext ul { margin: .5em 0; padding-left: 1.4em; }
.pv-atext a { color: var(--pv-accent, #0E7C7B); }
.pv-empty { color: var(--muted); text-align: center; padding: 20px 0; }
.pv-atext .fqh-h { font-size: 1.02em; font-weight: 700; color: #222; margin: 1.3em 0 .4em; padding-left: .55em; border-left: 3px solid var(--pv-accent, #0E7C7B); }
.pv-atext .fqh-img { margin: .7em 0; }
.pv-atext .fqh-img img { max-width: 100%; height: auto; border-radius: 8px; }
.pv-atext .fqh-callout { display: flex; gap: .6em; padding: .7em .9em; border-radius: 8px; margin: .7em 0; font-size: .95em; }
.pv-atext .fqh-callout-label { font-weight: 700; white-space: nowrap; }
.pv-atext .fqh-callout-warn { background: #FFF4E5; border: 1px solid #FFD9A8; }
.pv-atext .fqh-callout-hint { background: #EDF7ED; border: 1px solid #BCE0BD; }
.pv-atext .fqh-callout-important { background: #FDECEA; border: 1px solid #F5B9B3; }
.be-left { display: flex; align-items: center; gap: 2px; }

/* ============================================================
   スマホ(768px未満): サイドバーはドロワー化・全画面をレスポンシブに
   ※通常ルールに上書きされないよう必ずファイル末尾に置くこと
   ============================================================ */
/* --- AI提案(suggestions.php): 実際のFAQと同じ見せ方 + 提案理由 --- */
.sg-preview { margin-bottom: 12px; }
.sg-note { font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.sg-reason {
  background: var(--bg); border-left: 3px solid var(--accent); border-radius: 0 5px 5px 0;
  padding: 10px 14px; margin-bottom: 14px;
}
.sg-reason-label {
  display: inline-block; font-size: 11px; font-weight: 700; color: var(--accent);
  letter-spacing: .08em; margin-bottom: 2px;
}
.sg-reason-text { margin: 0; font-size: 13px; line-height: 1.7; color: var(--ink); }
.sg-reason-date { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
.sg-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sg-actions form { display: inline; }

/* --- 保存中の目隠し(AIのキーワード生成で十数秒かかることがあるため) --- */
.save-overlay {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.82);
}
/* display:flex が hidden 属性に勝ってしまうのを防ぐ(.modal-back と同じ対策)。
   これが無いと、隠れているはずの目隠しが画面全体を覆って操作できなくなる */
.save-overlay[hidden] { display: none; }
.save-overlay-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 5px;
  box-shadow: 0 10px 40px rgba(0,0,0,.14);
  padding: 28px 36px; text-align: center; max-width: 90vw;
}
.save-overlay-title { margin: 14px 0 0; font-size: 15px; font-weight: 700; }
.save-overlay-sub { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
/* くるくる(依存なしのCSSアニメーション) */
.spinner {
  width: 32px; height: 32px; margin: 0 auto;
  border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* 目が疲れる動きを避ける設定の人には回さない */
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
}

/* --- 資料からFAQ生成(generate.php): 案内ブロックと候補カード --- */
/* 画面の主役になる説明文(本文サイズ)。各入力欄の下の補足(.page-desc)より一段大きい */
.gen-intro { font-size:15px; line-height:1.9; color:var(--ink); margin:-4px 0 16px; }
.gen-note {
  background:var(--bg); border:1px solid var(--line); border-radius:5px;
  padding:14px 16px; margin-bottom:20px; font-size:14px; line-height:1.9;
}
.gen-note p { margin:0 0 6px; }
.gen-note-title { font-weight:700; color:var(--ink); }
.gen-note a { font-weight:600; }
/* 保存してある生成結果・生成中の知らせ(注意を引きたいが警告ではないので、赤い縦棒つきの白カード) */
.gen-saved {
  background:var(--panel); border:1px solid var(--line); border-left:4px solid var(--accent, #C0392B);
  border-radius:5px; padding:16px 18px; margin-bottom:20px; font-size:14px; line-height:1.9;
}
.gen-saved p { margin:0 0 10px; }
.gen-saved-title { font-weight:700; font-size:15px; color:var(--ink); }
.gen-saved-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.gen-saved[hidden], #gen-error[hidden], #gen-form-panel[hidden] { display:none; }
/* 生成の進み具合の棒 */
.gen-bar { height:8px; background:var(--line); border-radius:4px; overflow:hidden; margin:0 0 12px; }
.gen-bar span { display:block; height:100%; background:var(--accent); transition:width .4s; }
.gen-list { display:flex; flex-direction:column; gap:8px; }
/* 重複の印(CSVの取り込み)。注意の色=アンバー。チェックを外してある理由を、その候補の質問の横に出す */
.gen-dup { display:inline-block; margin-left:8px; padding:1px 8px; border-radius:4px; font-size:12px; font-weight:600;
  color:var(--warn); background:var(--warn-soft); white-space:nowrap; vertical-align:middle; }
.gen-item.is-dup { background:#FCFBF9; }
.gen-item {
  background:var(--bg); border:1px solid var(--line); border-radius:5px;
  padding:14px 16px; transition:border-color .15s;
}
.gen-item:hover { border-color:var(--accent, #C0392B); }
/* チェックボックスと質問文だけをラベルにする(回答の編集欄を触ってもチェックが動かないように) */
.gen-head { display:flex; gap:12px; align-items:flex-start; cursor:pointer; }
.gen-check { margin-top:3px; flex-shrink:0; width:18px; height:18px; }
.gen-body { padding-left:30px; }
.gen-q { font-weight:600; flex:1; min-width:0; }
/* 取り込んだあとの見え方。ここはHTML(段落・箇条書き)を描く */
.gen-a { font-size:13px; color:var(--sub); line-height:1.7; margin-top:6px; }
.gen-a p { margin:.4em 0; }
.gen-a ul { margin:.4em 0; padding-left:1.4em; }
.gen-a li { margin:.1em 0; }
.gen-a > :first-child { margin-top:0; }
.gen-a > :last-child { margin-bottom:0; }
.gen-a[hidden], .gen-edit[hidden] { display:none; }
.gen-edit { margin-top:8px; }
.gen-edit textarea { min-height:auto; font-size:13px; }
/* AIの利用料がかかる操作の印(丸に¥)。ボタンの文字の後ろに置く(lib/core.php の ai_cost_mark) */
.ai-cost {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 6px; border-radius: 50%;
  border: 1.5px solid currentColor; font-size: 10px; font-weight: 700; line-height: 1; vertical-align: middle; position: relative; top: -1px;
}
.ai-cost[hidden] { display: none; }
.btn.sm .ai-cost { width: 14px; height: 14px; font-size: 9px; margin-left: 4px; }

/* API使用量: AIの費用がかかる操作の一覧(自動で動く行は薄く色を付ける) */
.ai-op-auto td { background: #FFFBF5; }
.ai-op-auto-chip { background: var(--warn-soft); color: var(--warn); margin-left: 6px; }

/* 変更チェック(admin/change_check.php): 全サイトから、直す必要がありそうなFAQを探す */
.cc-sites { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.cc-site { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.cc-site input { width: auto; }
.cc-ai-note { margin: 10px 0 0; text-align: right; }
.cc-table td { vertical-align: top; }
.cc-table .cc-pick { width: 18px; height: 18px; }
.cc-why .chip { margin: 0 4px 4px 0; }
.cc-chip-ai { background: #EEF2FF; color: #3730A3; }
.cc-chip-ai.cc-level-high { background: var(--warn-soft); color: var(--warn); }
.cc-ai { font-size: 12px; color: var(--muted); line-height: 1.7; }
.cc-mark-actions { align-items: center; }
.cc-count { font-size: 13px; color: var(--muted); margin-right: auto; }
/* ボタンの文字が長いので、同幅120pxの決まりから外して文字に合わせる */
.cc-actions .btn, .cc-mark-actions .btn { width: auto; min-width: 120px; padding-left: 18px; padding-right: 18px; }

/* 設定ページ: 閲覧が少ないFAQの点検(期間・回数を1行に並べる。スマホでは折り返す) */
.low-view-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.low-view-row select { width: auto; min-width: 120px; }
.low-view-word { font-size: 14px; }
.low-view-part { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.low-view-row [hidden] { display: none; }

/* カテゴリのプルダウン(左)と編集ボタン(右下)を同じ段に置く */
.gen-tools { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:10px; flex-wrap:wrap; }
.gen-cat { display:flex; align-items:center; gap:8px; font-size:12px; font-weight:600; color:var(--muted); }
.gen-cat select { width:auto; min-width:150px; padding:5px 8px; font-size:13px; }
.gen-edit-btn { min-width:130px; }

@media (max-width: 767px) {
  .embed-layout-grid { grid-template-columns: 1fr; }
  .color-swatches { grid-template-columns: repeat(5, 36px); gap: 8px; }
  .color-swatch { width: 36px; height: 36px; }
  /* --- ヘッダ: 1段目=ハンバーガー+ロゴ / 2段目=ページ名+ユーザーメニュー --- */
  /* スマホは2段で背が高いため固定しない(画面を圧迫する。メニューはドロワーで届く) */
  .topbar { flex-wrap: wrap; min-height: 0; padding: 8px 12px 6px; position: static; }
  .menu-btn { display: inline-flex; margin-left: 0; }
  .logo, body.side-closed .logo { width: auto; padding: 0 4px; }
  .logo-full, body.side-closed .logo-full { display: block; width: 126px; }
  .logo-icon, body.side-closed .logo-icon { display: none; }
  .topbar-inner { flex-basis: 100%; padding: 8px 2px 2px; gap: 10px; }
  .topbar-title { font-size: 15px; border-left-width: 3px; padding-left: 10px; }
  /* ヘッダの操作ボタンはドロワー内(.side-mobile-actions)に出すので隠す */
  .topbar-actions .tb-btn { display: none; }

  /* --- サイドバー → 左からスライドするドロワー --- */
  .shell { flex-direction: column; min-height: 0; }
  .side, body.side-closed .side {
    position: fixed; top: 0; left: 0; z-index: 1100;
    width: 272px; max-width: 84vw;
    height: 100dvh;
    padding: 14px 0 0;
    transform: translateX(-105%); transition: transform .22s ease;
    overflow-y: auto;
  }
  body.side-open .side { transform: translateX(0); box-shadow: 8px 0 40px rgba(0,0,0,.3); }
  body.side-open { overflow: hidden; } /* ドロワー表示中は後ろをスクロールさせない */
  .side-backdrop:not([hidden]) { display: block; }
  /* デスクトップ用の折りたたみ状態(side-closed)はドロワーでは無効にする */
  body.side-closed .side .s-label { display: inline; }
  body.side-closed .side-site { display: block; }
  body.side-closed .side-item { justify-content: flex-start; padding: 11px 20px; }
  .side-toggle { display: none; }
  .side-bottom { position: static; padding-bottom: 4px; }
  .side nav.side-mobile-actions { display: flex; }

  /* --- 本文 --- */
  .main { padding: 18px 14px 40px; }
  .panel { padding: 16px; }
  th, td { padding: 8px 10px; }
  /* 列が多い一覧は潰さず横スクロールで見せる */
  .table-scroll table { min-width: 560px; }
  .table-scroll .sortable-table { min-width: 640px; }

  .filter-grid { grid-template-columns: 1fr; gap: 4px; }
  .filter-grid .filter-label { margin-top: 10px; }
  .filter-grid .filter-label:first-child { margin-top: 0; }
  .toolbar { flex-wrap: wrap; }
  .add-row { flex-wrap: wrap; }
  .add-row select { max-width: none; }
  /* 横並びのボタンは、文字の長さに応じて幅を配る。
     flex:1 だと「やり直す」と「下書きとして取り込む」が同じ幅になり、
     長いほうの文字がボタンからはみ出す(.btnは折り返さない設定のため。2026-09-27) */
  .form-actions .btn { flex: 1; min-width: max-content; padding-left: 12px; padding-right: 12px; }
  /* 変更チェック: 下のボタンは3つ＋件数。横に並ばないので、件数を上の段、「印を付ける」を下の段いっぱいにする */
  .cc-mark-actions { flex-wrap: wrap; }
  .cc-count { flex-basis: 100%; margin-right: 0; }
  #cc-mark { flex-basis: 100%; order: 3; }
  .cc-ai-note { text-align: left; }

  /* 数字カードは2列に */
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 12px 14px; }
  .stat-num { font-size: 22px; }
  .todo-grid { grid-template-columns: 1fr; }
  .rpt-summary { grid-template-columns: repeat(2, 1fr); }
  .report-card-stats { flex-wrap: wrap; gap: 10px 20px; }

  /* iOSは16px未満のinput/textareaにフォーカスすると自動ズームするため */
  input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], textarea, select { font-size: 16px; }
  /* クラスで文字サイズを指定している入力欄は上の行に勝ってしまうので、同じ強さで戻す */
  .gen-edit textarea, .gen-cat select { font-size: 16px; }

  .modal { padding: 20px; max-height: calc(100dvh - 32px); overflow-y: auto; }
  .modal-actions { position: sticky; bottom: 0; background: #fff; padding-top: 12px; }
  /* 公開の確認・点検済みの確認はボタンが3つ。スマホの幅には並ばないので、「編集に戻る」だけ下の段に落とす
     (並べたままだと左にはみ出して見えなくなる。背景を押しても閉じないので、見えないと戻れない) */
  #publish-modal .modal-actions, #review-modal .modal-actions { flex-wrap: wrap; }
  #publish-modal .modal-actions .btn, #review-modal .modal-actions .btn { flex: 1; min-width: max-content; }
  #publish-back, #review-back { order: 3; flex-basis: 100% !important; margin-right: 0 !important; }
  .kw-cols { grid-template-columns: 1fr; }
  /* キーボードが出ても操作できるよう入力欄を低く抑える(画面が入力欄だけで埋まらないように) */
  .kw-cols textarea { min-height: 120px; height: 180px; max-height: 180px; }

  .toast-wrap { left: 20px; }

  /* フッタは画面固定をやめて本文の最後に流す(狭い画面を圧迫しない) */
  .admin-footer, body.side-closed .admin-footer {
    position: static; margin-top: 28px; padding: 14px 0 4px;
    background: transparent; border-top: 1px solid var(--line);
  }

  /* --- 一覧テーブルをカード表示に(横長の表の右列が横スクロール外に隠れるのを防ぐ) --- */
  /* .card-table を付けた表は、スマホでは1行=1枚のカードに変形する。
     各セルの data-label="見出し" がカード内でラベルとして出る。PC表示は通常の表のまま。 */
  .card-table, .table-scroll .card-table { min-width: 0 !important; width: 100%; }
  .card-table thead { display: none; }
  .card-table tbody, .card-table tr, .card-table td { display: block; width: auto; }
  .card-table tr {
    border: 1px solid var(--line); border-radius: 5px; background: #fff;
    padding: 10px 14px; margin-bottom: 10px;
  }
  .card-table td { border: none; padding: 3px 0; text-align: left !important; white-space: normal; }
  .card-table td[data-label]::before {
    content: attr(data-label) "："; color: var(--muted); font-size: 12px; font-weight: 600;
  }
  .card-table td.card-title { font-weight: 700; font-size: 15px; padding-bottom: 4px; }
  .card-table td.card-hide { display: none; }
  .card-table td.card-inline { display: inline-block; padding-right: 20px; }
  .card-table td.card-inline[data-label]::before { display: inline; margin-right: 4px; }
  .card-table td input[type="text"] { width: 100%; }
}

/* ===================================================================
   印刷（ブラウザの「PDFとして保存」用）
   ※スマホ用ブロックより後に置く。印刷時は用紙幅で判定されるため、
     機種によってスマホ用ルールが効いてしまうのを確実に打ち消すため
   =================================================================== */
/* 紙の余白。指定しないとブラウザ任せ(だいたい12mm)で左右が詰まって見える。
   左右を厚めに取って本文を読みやすくする */
@page { margin: 14mm 18mm; }

@media print {
  /* 画面用の操作部品は印刷しない */
  .side, .topbar, .admin-footer, .toolbar, .side-backdrop, .menu-btn,
  .btn, .user-menu, .panel-more, .list-add { display: none !important; }

  /* 余白と背景をリセットして、本文を全幅で出す */
  :root { padding: 0 !important; }
  body { background: #fff !important; font-size: 11pt; }
  /* 左右の余白は @page だけに頼らない。ブラウザの印刷設定で「余白: なし/最小」を
     選ばれると @page が無視されるため、本文側にも持たせて確実に空ける */
  .main, .content, .wrap { margin: 0 !important; padding: 0 10mm !important; width: auto !important; max-width: none !important; }
  .panel { border: none !important; box-shadow: none !important; padding: 0 !important; margin: 0 0 14pt !important; background: #fff !important; }

  /* 印刷のときだけ出す見出し */
  .print-head { display: block !important; margin-bottom: 14pt; padding-bottom: 8pt; border-bottom: 2px solid #C0392B; }
  .print-head-title { font-size: 12pt; color: #555; }
  .print-head-sub { font-size: 18pt; font-weight: 700; margin-top: 2pt; }

  /* 数字カードは2×2に固定する。紙幅では自動折り返しだと「3枚+1枚」になって不格好 */
  .rpt-summary { grid-template-columns: repeat(2, 1fr) !important; }

  /* 数字カード・グラフの色を紙にも出す（既定では背景色が落ちるため） */
  .rpt-summary, .rpt-card, .rpt-bar, .rpt-bar-fill, .chip, .rpt-zero, .rpt-table th, .rpt-table td {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* 途中で切れると読めなくなるものは、ページをまたがせない */
  .rpt-card, .rpt-table-wrap, table, tr, .rpt-bar, .rpt-zero { page-break-inside: avoid; break-inside: avoid; }
  h2, h3, h4 { page-break-after: avoid; break-after: avoid; }
  .report-body h2 { page-break-before: auto; }

  /* 表は横スクロールの箱をやめて、そのまま紙に載せる。
     幅は中身に合わせる（2列の表を紙幅いっぱいに伸ばすと間延びして読みにくい） */
  .rpt-table-wrap { overflow: visible !important; }
  .report-body .rpt-table { width: auto !important; max-width: 100% !important; min-width: 0 !important; font-size: 10pt; }

  /* リンクは下線だけ残す（URLは印字しない＝レポートが読みにくくなるため） */
  a { text-decoration: none !important; color: inherit !important; }

  /* 本文先頭のタイトル（AIが書いた「2026-06 FAQ運用レポート」）は、
     上の .print-head と内容が重なるので印刷では隠す */
  .report-body > h2:first-child { display: none !important; }
}

/* 印刷用の見出しは画面では隠す */
.print-head { display: none; }
