/* 検索管理コンソール 共通スタイル
   出自: Docs/Design/admin_mockup_ranking_tools.html (2026-08-20) のインライン CSS を昇格。
   nav はモックの <button> タブから <a> リンクに変更。 */
:root {
  --bg: #f4f6f8; --card: #fff; --line: #d9dee3; --text: #1f2937;
  --sub: #6b7280; --primary: #0f6db4; --green: #157347; --amber: #b45309;
  --red: #b91c1c; --note: #fff8e1; --noteline: #e8c56a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif; font-size: 14px; }
a { color: var(--primary); }

header { background: #163a5f; color: #fff; padding: 10px 24px; display: flex; align-items: center; gap: 14px; }
header h1 { font-size: 16px; margin: 0; font-weight: 600; }
header h1 a { color: #fff; text-decoration: none; }
header .env { font-size: 11px; background: #e8b93c; color: #333; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; }
header .env-wrap { position: relative; outline: none; }
header .targets { display: none; position: absolute; top: 100%; left: 0; z-index: 10; flex-direction: column; gap: 4px; margin-top: 4px; padding: 8px; background: #163a5f; border: 1px solid #24507d; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.3); }
header .env-wrap:hover .targets, header .env-wrap:focus .targets { display: flex; }
header .target { font-size: 11px; padding: 1px 7px; border-radius: 4px; background: #24507d; color: #dbe6f2; white-space: nowrap; }
header .target.t-ローカル { background: #2f6b4f; }
header .target.t-AWS { background: #7a4a1d; }
header .target.t-未設定 { background: #4b5563; color: #aab4c0; }
header .mock { font-size: 11px; background: #b91c1c; color: #fff; padding: 2px 8px; border-radius: 4px; }
header .spacer { flex: 1; }
header .user { font-size: 12px; color: #cfd8e3; }
header .user form { display: inline; }
header .user button { border: none; background: none; color: #fff; text-decoration: underline; cursor: pointer; font-size: 12px; padding: 0; }

nav { background: #fff; border-bottom: 1px solid var(--line); padding: 0 24px; display: flex; gap: 4px; flex-wrap: wrap; }
nav a { display: inline-block; padding: 12px 14px; font-size: 13.5px; text-decoration: none;
        border-bottom: 3px solid transparent; color: var(--sub); white-space: nowrap; }
nav a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
nav a:hover { color: var(--text); }
nav .sep { width: 1px; background: var(--line); margin: 10px 6px; }

main { max-width: 1080px; margin: 20px auto; padding: 0 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.card h2 { font-size: 15px; margin: 0 0 4px; }
.card .desc { color: var(--sub); font-size: 12.5px; margin-bottom: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: middle; }
th { background: #f8fafc; color: var(--sub); font-weight: 600; font-size: 12px; }

.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.b-live { background: #e6f4ea; color: var(--green); }
.b-wait { background: #fef3c7; color: var(--amber); }
.b-off  { background: #f3f4f6; color: var(--sub); }
.b-exp  { background: #fee2e2; color: var(--red); }

.tags span { background: #e8f1fa; color: var(--primary); padding: 2px 8px; border-radius: 4px;
             margin-right: 4px; font-size: 12px; display: inline-block; }
.tags span.vec { background: #f3e8fa; color: #7c3aed; }
.legend { font-size: 11.5px; color: var(--sub); margin-bottom: 10px; }
.legend span { font-size: 11px; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 14px;
       font-size: 13px; cursor: pointer; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.small { padding: 3px 10px; font-size: 12px; }
/* ② 検索プレビューの入力部: 左に 1 行目=検索語・店舗番号 / 2 行目=件数・並び順 (右寄せ)、右に 2 行分の高さのボタン */
.preview-form { display: grid; grid-template-columns: 1fr auto auto; grid-template-rows: auto auto; gap: 8px; margin-bottom: 12px; }
.preview-form .pf-main { grid-column: 1; grid-row: 1; display: flex; gap: 8px; }
.preview-form .pf-main input[type=text] { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; min-width: 0; }
.preview-form .pf-main input[name=q] { flex: 1; }
.preview-form .pf-main input[name=sno] { width: 220px; }
.preview-form .pf-opts { grid-column: 1; grid-row: 2; display: flex; gap: 8px; align-items: center; min-width: 0; }
.preview-form .pf-selects { display: flex; gap: 8px; margin-left: auto; flex-shrink: 0; }
.preview-form select { border: 1px solid var(--line); border-radius: 6px; padding: 7px; }
.preview-form .pf-search { grid-column: 2; grid-row: 1 / span 2; }
.preview-form .pf-register { grid-column: 3; grid-row: 1 / span 2; display: flex; }
.preview-form .pf-register .btn { height: 100%; }
.hint-wrap :disabled { pointer-events: none; }   /* 無効な部品の上でも、親の title (案内) を出す */
.panel-empty { font-size: 12.5px; color: var(--sub); margin-top: 6px; }
.btn.golden { line-height: 1.3; text-align: center; background: #fff8d6; border-color: #e8d98a; color: #6b5a00; }
.btn.golden:hover:not(:disabled) { background: #fff1b0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.loading { cursor: progress; }
.btn.loading::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 6px; vertical-align: -1px;
                       border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: btn-spin .7s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
.cell-loading { color: var(--sub); }
.cell-loading::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 6px; vertical-align: -1px;
                        border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: btn-spin .7s linear infinite; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.toolbar input[type=text] { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; width: 300px; }
.toolbar select { border: 1px solid var(--line); border-radius: 6px; padding: 7px; }

.note { background: var(--note); border: 1px solid var(--noteline); border-radius: 8px;
        padding: 10px 14px; font-size: 12.5px; margin: 14px 0 0; }
.note b { color: var(--amber); }

.form { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; align-items: center;
        background: #f8fafc; border: 1px dashed var(--line); border-radius: 8px; padding: 14px 16px; margin-top: 14px; }
.form label { color: var(--sub); font-size: 12.5px; text-align: right; }
.form input, .form select { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font-size: 13px; width: 100%; max-width: 420px; }
.form .actions { grid-column: 2; }
.mult { font-variant-numeric: tabular-nums; font-weight: 600; }

.rebuild-bar { display: flex; align-items: center; gap: 10px; background: #eef4fa; border: 1px solid #c8dcee;
               border-radius: 8px; padding: 8px 14px; margin-bottom: 16px; font-size: 12.5px; }
.rebuild-bar .spacer { flex: 1; }

.alert-strip { background: #fff8e1; padding: 8px 12px; font-size: 11.5px; border: 1px solid var(--noteline); }

.two-col { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.side-list { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.side-list .head { background: #f8fafc; padding: 8px 12px; font-size: 12px; color: var(--sub); display: flex; justify-content: space-between; }
.side-list .body { max-height: 320px; overflow-y: auto; }
.side-list .row { padding: 9px 12px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.side-list .row:last-child { border-bottom: none; }
.side-list .row.selected { background: #e8f1fa; border-left: 3px solid var(--primary); }
.side-list .row .meta { color: var(--sub); font-size: 12px; }
.side-list .foot { background: #fff8e1; padding: 8px 12px; font-size: 11.5px; border-top: 1px solid var(--noteline); }

.panel { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.panel b.h { font-size: 12.5px; }
.panel table { font-size: 12px; margin-top: 6px; }
.panel td { border: none; }
.panel td.k { color: var(--sub); }
.panel td.r { text-align: right; }

.placeholder { border: 1px dashed var(--line); border-radius: 8px; padding: 24px; color: var(--sub); background: #fafbfc; }
.placeholder ul { margin: 8px 0 0; padding-left: 20px; }

footer { text-align: center; color: var(--sub); font-size: 11px; padding: 20px; }

/* ログイン */
.login-wrap { max-width: 380px; margin: 80px auto; }
.login-wrap .card h2 { margin-bottom: 14px; }
.login-wrap label { display: block; font-size: 12.5px; color: var(--sub); margin: 10px 0 4px; }
.login-wrap input[type=text], .login-wrap input[type=password] { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 14px; }
.login-wrap .btn { width: 100%; margin-top: 16px; padding: 9px; }
.login-wrap .errorlist { color: var(--red); font-size: 12.5px; list-style: none; padding: 0; margin: 0 0 8px; }

/* --- 実画面化 (feature/admin-alpha) で追加 --- */
.messages { list-style: none; padding: 0; margin: 0 0 14px; }
.messages li { border-radius: 8px; padding: 8px 14px; font-size: 13px; margin-bottom: 6px; border: 1px solid var(--line); background: #fff; }
.messages li.success { background: #e6f4ea; border-color: #b7dfc3; color: var(--green); }
.messages li.error { background: #fee2e2; border-color: #f5b5b5; color: var(--red); }
.messages li.warning { background: #fef3c7; border-color: var(--noteline); color: var(--amber); }

.errorlist { color: var(--red); font-size: 12px; list-style: none; padding: 0; margin: 2px 0 0; }
.form .field { display: flex; flex-direction: column; gap: 2px; }
.form .help { color: var(--sub); font-size: 11px; }
.form .nonfield { grid-column: 1 / -1; }
.form input[type=checkbox] { width: auto; align-self: flex-start; margin: 0; }   /* 有効などのチェックは左寄せ */
.form textarea { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font-size: 13px; width: 100%; max-width: 420px; min-height: 60px; }

.kind-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px;
               padding: 8px 14px; margin-bottom: 14px; font-size: 12.5px; background: #fbfcfd; }
.kind-status .spacer { flex: 1; }
.kind-status form { display: inline; }

form.inline { display: inline; }
.link-btn { border: none; background: none; color: var(--primary); cursor: pointer; padding: 0; font-size: 12px; text-decoration: underline; }
.danger { color: var(--red); }
/* 規則の行の操作は <a> と <button> が混ざるので、高さ・文字をそろえる */
.btn.btn-edit, .btn.btn-stop, .btn.btn-enable, .btn.btn-delete { display: inline-block; box-sizing: border-box; font-family: inherit; line-height: 18px; vertical-align: middle; }
/* 規則の行の操作: 編集 = 青、停止 = 琥珀、有効化 = 緑、削除 = 赤 */
.btn.btn-edit { background: #e8f1fa; border-color: #b9d3ea; color: var(--primary); text-decoration: none; }
.btn.btn-stop { background: #fef3c7; border-color: #f0d98a; color: var(--amber); }
.btn.btn-enable { background: #e6f4ea; border-color: #b7dfc3; color: var(--green); }
.btn.btn-delete { background: #fee2e2; border-color: #f5b5b5; color: var(--red); }
.muted { color: var(--sub); font-size: 12px; }
.side-list .row a { text-decoration: none; color: inherit; }
.word-links { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; font-size: 11.5px; color: var(--sub); }
.word-links .label { white-space: nowrap; }
.word-links .items { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding-bottom: 2px; }   /* 溢れたら横スクロール */
.word-links .items .btn { flex-shrink: 0; }
.word-links a.btn { text-decoration: none; color: var(--text); }
.clearable { position: relative; display: inline-flex; vertical-align: middle; min-width: 0; max-width: 100%; }
.form .clearable { display: flex; width: 100%; max-width: 420px; }
.login-wrap .clearable { display: flex; width: 100%; }
.toolbar .clearable { width: 300px; }
.clearable input, .clearable textarea { width: 100%; padding-right: 26px !important; }
.clearable .clear-x { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: none;
                      color: var(--sub); font-size: 14px; line-height: 1; cursor: pointer; padding: 2px 4px; }
.clearable-area .clear-x { top: 8px; transform: none; }
.clearable .clear-x:hover { color: var(--text); }
.clearable .clear-x[hidden] { display: none; }
.preview-form .pf-main .clearable-q { flex: 1; }
.preview-form .pf-main .clearable-sno { width: 220px; }
.preview-form .pf-main .clearable input[name=sno] { width: 100%; }
.nowrap { white-space: nowrap; }
.btn-stack { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.fill-goods { color: var(--primary); text-decoration: underline; cursor: pointer; }
.badge.b-vec { background: #f3e8fa; color: #7c3aed; }
.pick-row { cursor: pointer; }
.pick-row:hover td { background: #f3f7fb; }
tr.pick-row.picked td, tr.pick-row.picked:hover td { background: #fff3c4; }   /* 選択中はホバーより優先 (マウスが乗っていても黄色) */
tr.picked td:first-child { box-shadow: inset 4px 0 0 var(--primary); }
/* 商品を選んだら、タグ・強化語・辞書承認のボタンを青く反転する */
.act-btn.on, .word-links a.btn.act-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
/* 種類ごとの色: 検索タグ = 青、強化語 = 紫 (タグ一覧の語の色と同じ)、辞書承認 = 琥珀。商品を選んだ (.on) ら濃い色で反転する */
.btn.act-tag, .word-links a.btn.act-tag { background: #e8f1fa; border-color: #b9d3ea; color: var(--primary); }
.btn.act-enrich, .word-links a.btn.act-enrich { background: #f3e8fa; border-color: #d8bdee; color: #7c3aed; }
.btn.act-dict, .word-links a.btn.act-dict { background: #fef3c7; border-color: #f0d98a; color: var(--amber); }
.btn.act-tag.on, .word-links a.btn.act-tag.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.act-enrich.on { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.btn.act-dict.on { background: var(--amber); border-color: var(--amber); color: #fff; }
.pager { display: flex; gap: 10px; justify-content: center; margin-top: 12px; font-size: 13px; }
.tags form.inline button { border: none; background: none; color: var(--sub); cursor: pointer; padding: 0 0 0 2px; font-size: 11px; }
/* 一覧の語を選択してコピーするとき、外す「×」が混ざらないようにする */
.tags form.inline, .tags form.inline button, .clearable .clear-x { -webkit-user-select: none; user-select: none; }
tr.violation { background: #fff0f0; }

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 10px; font-size: 12.5px; }
.pager a, .pager .cur, .pager .off { padding: 3px 9px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; background: #fff; }
.pager .cur { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager .off { color: var(--sub); opacity: .55; }
.pager .gap { color: var(--sub); }

details.add-words { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 14px; background: #fff; overflow: hidden; }
details.add-words > summary { cursor: pointer; font-size: 13.5px; font-weight: 600; padding: 8px 14px; background: #e8f1fa; color: var(--primary); }   /* ヘッダ部分だけ薄く色をつける */
details.add-words > summary:hover { background: #dcebf8; }
details.add-words > form { padding: 12px 14px; }

/* 画面見出しの右に「！」を置き、押すと説明を開閉する */
.page-head { position: relative; display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.page-head h2 { margin: 0; }
.page-help summary { list-style: none; cursor: pointer; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--primary);
                     color: var(--primary); background: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.page-help summary::-webkit-details-marker { display: none; }
.page-help[open] summary, .page-help summary:hover { background: var(--primary); color: #fff; }
.page-help-body { position: absolute; left: 0; top: 100%; z-index: 5; width: min(640px, 100%); margin-top: 6px; padding: 10px 14px;
                  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.page-help-body p { margin: 0 0 4px; line-height: 1.6; }
.page-help-body p:last-child { margin-bottom: 0; }
