/* カラーレスラボ サイトの出し入れ（管理画面）2026-10-29 */
[hidden] { display: none !important; }
:root {
  --bg: #f4f2ee; --panel: #ffffff; --ink: #1d2427; --ink2: #5b6569; --line: #d9d5cc; --soft: #ece8e0;
  --test: #c24d3d; --stage: #2f6fb0; --prod: #2c7a4b; --warn: #b7791f; --bad: #b3261e; --accent: #1f5f8b;
  --radius: 10px; color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 16px; }

/* 上の帯 */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: #1d2427; color: #fff; }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 52px; flex-wrap: wrap; }
.top h1 { font-size: 16px; margin: 0; letter-spacing: .04em; }
.top h1 small { opacity: .7; font-weight: 400; margin-left: 8px; }
.top .grow { flex: 1; }
.top button { background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 6px; padding: 4px 12px; }
.top .loading { font-size: 13px; opacity: .8; }

/* 3つの環境 */
.envs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.env { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; border-top: 5px solid var(--line); min-width: 0; }
.env.test { border-top-color: var(--test); } .env.staging { border-top-color: var(--stage); } .env.production { border-top-color: var(--prod); }
.env h2 { margin: 0 0 2px; font-size: 15px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.env h2 small { font-weight: 400; color: var(--ink2); font-size: 12px; }
.env a.url { font-size: 13px; word-break: break-all; }
.env .meta { font-size: 12.5px; color: var(--ink2); margin-top: 6px; }
.env .note { font-size: 12.5px; margin-top: 6px; }
.chip { display: inline-block; font-size: 12px; line-height: 1.5; padding: 0 8px; border-radius: 999px; background: var(--soft); color: var(--ink2); white-space: nowrap; }
.chip.ok { background: #e3f2e8; color: var(--prod); } .chip.wait { background: #fdf1dc; color: var(--warn); } .chip.bad { background: #fbe4e1; color: var(--bad); }
.chip.test { background: #fbe7e3; color: var(--test); } .chip.staging { background: #e2edf8; color: var(--stage); } .chip.production { background: #e3f2e8; color: var(--prod); }

/* タブ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; border-bottom: 3px solid transparent; color: var(--ink2); white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }
.tabs .badge { margin-left: 4px; }

/* エリア */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 16px; align-items: start; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.tools input[type="search"], .tools select { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; background: #fff; min-width: 0; }
.tools input[type="search"] { flex: 1 1 220px; }
.tools label { font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; }
.areas { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.group-head { background: var(--soft); padding: 6px 12px; font-size: 13px; font-weight: 700; color: var(--ink2); display: flex; gap: 8px; align-items: center; }
.area { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; gap: 10px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--soft); }
.area:first-child { border-top: 0; }
.area.changed { background: #fffbea; }
.area .name { min-width: 0; }
.area .name b { font-weight: 600; display: block; }
.area .name code { font-size: 11.5px; color: var(--ink2); }
.area .tags { margin-top: 2px; display: flex; gap: 4px; flex-wrap: wrap; }
.col-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; gap: 10px; padding: 6px 12px; font-size: 12px; color: var(--ink2); border-bottom: 1px solid var(--line); background: #faf9f6; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 3px 9px; font-size: 13px; color: var(--ink2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg.test button[aria-pressed="true"].show { background: var(--test); color: #fff; }
.seg.staging button[aria-pressed="true"].show { background: var(--stage); color: #fff; }
.seg button[aria-pressed="true"].hide { background: #5b6569; color: #fff; }
.seg button.was { box-shadow: inset 0 -3px 0 #e8b400; }
.prod-state { min-width: 74px; text-align: center; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 5px 12px; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.danger { color: var(--bad); border-color: #e5b3ae; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { padding: 2px 9px; font-size: 13px; }

/* 見本（テスト環境のページ） */
.preview { position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.preview .bar { display: flex; gap: 6px; align-items: center; padding: 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.preview .bar select { flex: 1 1 160px; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.preview .bar .chip { cursor: pointer; border: 0; }
.preview .frame { position: relative; width: 100%; height: min(72vh, 820px); background: #111; }
.preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.preview .hint { font-size: 12px; color: var(--ink2); padding: 6px 10px; }

/* 下の「変える物」の帯 */
.tray { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #1d2427; color: #fff; padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -4px 18px rgba(0,0,0,.2); }
.tray .wrap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tray .sum { flex: 1 1 260px; font-size: 14px; }
.tray .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.tray .btn.primary { background: #ffcf3a; color: #1d2427; border-color: #ffcf3a; font-weight: 700; }
body.has-tray { padding-bottom: 76px; }

/* ダイアログ */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15,20,22,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal .box { background: var(--panel); border-radius: 12px; width: min(760px, 100%); max-height: 88vh; overflow: auto; padding: 18px 20px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal h3 { margin: 0 0 10px; }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.modal ul { padding-left: 20px; margin: 6px 0; }
.modal textarea, .modal input[type="text"] { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.callout { background: #fdf6e3; border: 1px solid #f0dca8; border-radius: 8px; padding: 8px 12px; font-size: 13.5px; margin: 8px 0; }
.callout.info { background: #eef4fa; border-color: #c9dbee; }
.callout.bad { background: #fbe9e7; border-color: #f1c1bb; }

/* 差し替え */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.slot { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; text-align: left; padding: 0; }
.slot .th { aspect-ratio: 16 / 10; background: #222 center / contain no-repeat; position: relative; display: flex; align-items: center; justify-content: center; color: #ccc; font-size: 12px; }
.slot .th img { max-width: 100%; max-height: 100%; display: block; }
.slot .cap { padding: 6px 8px; font-size: 12px; word-break: break-all; }
.slot .cap b { display: block; font-size: 12.5px; }
.slot .marks { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 8px 8px; }
.cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.cand { border: 2px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.cand.on-test { border-color: var(--test); } .cand.on-staging { box-shadow: 0 0 0 3px var(--stage); }
.cand .th { aspect-ratio: 16/10; background: #222; display: flex; align-items: center; justify-content: center; }
.cand .th img, .cand .th video { max-width: 100%; max-height: 100%; }
.cand .cap { font-size: 12px; padding: 6px; }
.cand .pick { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 6px 6px; }
.dirs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.dirs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.dirs button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 履歴 */
.hist { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.hist .item { padding: 10px 14px; border-top: 1px solid var(--soft); }
.hist .item:first-child { border-top: 0; }
.hist .item .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.hist .item .when { font-size: 12.5px; color: var(--ink2); min-width: 92px; }
.hist .item .sum { flex: 1 1 320px; }
.hist .item details { margin-top: 4px; font-size: 13px; color: var(--ink2); }
.hist .item details ul { margin: 4px 0; padding-left: 20px; }

/* 本番との違い・頼み */
.box-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.box-list li { word-break: break-all; }
.form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.form textarea { width: 100%; min-height: 110px; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.form .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.form select, .form input[type="text"] { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; min-width: 0; }

/* 大きく見る（ライトボックス）：絵の外を押すと閉じる */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(8,10,12,.88); }
/* 絵の置き場：拡大した時は動かして（スクロールして）見る。ボタンと名前はいつも絵より手前 */
.lightbox #lb-stage { position: absolute; inset: 0; overflow: auto; display: flex; z-index: 1; }
.lightbox #lb-stage > img, .lightbox #lb-stage > video { margin: auto; flex: none; max-width: 92vw; max-height: 86vh; box-shadow: 0 6px 30px rgba(0,0,0,.5); background: #333; }
.lightbox.zoomed #lb-stage > img { max-width: none; max-height: none; cursor: grab; }
.lightbox .lb-tools { position: fixed; z-index: 2; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; display: flex; gap: 6px; }
.lightbox .lb-tools button { background: rgba(20,24,26,.75); color: #fff; border: 1px solid rgba(255,255,255,.45); border-radius: 6px; padding: 4px 10px; }
.lightbox .lb-cap { position: fixed; z-index: 2; left: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); color: #ddd; font-size: 13px; max-width: 80vw; word-break: break-all; background: rgba(20,24,26,.6); padding: 2px 8px; border-radius: 4px; }

/* ログイン */
.login-main { max-width: 26rem; padding-top: 12vh; }
.login-kicker { letter-spacing: .12em; margin: 0; }
.login-title { margin: .4rem 0 1.4rem; }
.login-input { width: 100%; padding: .7rem; border: 1px solid var(--line); border-radius: 6px; margin-top: .4rem; }
.login-remember { display: flex; gap: .5rem; align-items: center; margin-top: .8rem; }
.login-btn { width: 100%; margin-top: 1rem; padding: .7rem; }
.login-err { min-height: 1.6em; }
.login-forget { margin: 0; }
.form h3 { margin: 0 0 6px; }
.form .lead { margin: 0 0 8px; }
.grow { flex: 1; }

.empty { color: var(--ink2); padding: 18px; text-align: center; }
.err { color: var(--bad); }
.small { font-size: 12.5px; color: var(--ink2); }

@media (max-width: 1080px) { .layout { grid-template-columns: minmax(0, 1fr); } .preview { position: static; } }
@media (max-width: 760px) {
  .envs { grid-template-columns: minmax(0, 1fr); }
  .col-head { display: none; }
  .area { grid-template-columns: minmax(0, 1fr) auto; }
  .area .name { grid-column: 1 / -1; }
  .area .cell::before { content: attr(data-label); display: block; font-size: 11px; color: var(--ink2); }
}
