/* ホールAIO 管理画面。WordPress 管理画面の配置・配色に寄せる（担当者が迷わないため） */
:root {
  --wp-dark: #1d2327; --wp-dark2: #2c3338; --wp-blue: #2271b1; --wp-blue-d: #135e96;
  --wp-bg: #f0f0f1; --wp-border: #c3c4c7; --wp-text: #1d2327; --wp-muted: #646970;
  --wp-menu-text: #f0f0f1; --wp-red: #d63638; --wp-green: #00a32a; --wp-yellow: #dba617;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 13px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif; color: var(--wp-text); background: var(--wp-bg); }
a { color: var(--wp-blue); }
button, input, select, textarea { font: inherit; }
.loading { padding: 40px; color: var(--wp-muted); }
[hidden] { display: none !important; }

/* ---- ログイン ---- */
.login-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login { width: 100%; max-width: 360px; background: #fff; border: 1px solid var(--wp-border); padding: 26px 24px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.login h1 { font-size: 20px; margin: 0 0 18px; text-align: center; }
.login label { display: block; margin-bottom: 14px; }
.login input { width: 100%; padding: 8px 10px; border: 1px solid #8c8f94; border-radius: 4px; font-size: 16px; }

/* ---- 上部バー・左メニュー ---- */
.topbar { position: sticky; top: 0; z-index: 10; height: 40px; background: var(--wp-dark); color: var(--wp-menu-text); display: flex; align-items: center; gap: 14px; padding: 0 12px; }
.topbar .brand { color: #fff; font-weight: 700; text-decoration: none; white-space: nowrap; }
.topbar .sel { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #c3c4c7; }
.topbar select { background: var(--wp-dark2); color: #fff; border: 1px solid #50575e; border-radius: 3px; padding: 3px 6px; max-width: 200px; }
.topbar .spacer, .spacer { flex: 1; }
.topbar a { color: #c3c4c7; text-decoration: none; font-size: 12px; white-space: nowrap; }
.topbar a:hover, .topbar .link:hover { color: #72aee6; }
.topbar .who { font-size: 12px; color: #fff; white-space: nowrap; }
.topbar .link { background: none; border: 0; color: #c3c4c7; cursor: pointer; font-size: 12px; padding: 0; }
.deploy-info { font-size: 11px; color: #a7aaad; white-space: nowrap; }
.frame { display: flex; min-height: calc(100% - 40px); }
.menu { width: 160px; flex: none; background: var(--wp-dark); padding-top: 10px; }
.menu a { display: block; color: var(--wp-menu-text); text-decoration: none; padding: 8px 12px; font-size: 14px; }
.menu a:hover { color: #72aee6; background: var(--wp-dark2); }
.menu a.active { background: var(--wp-blue); color: #fff; }
.menu .sub { padding-left: 24px; font-size: 13px; }
main { flex: 1; min-width: 0; padding: 20px 20px 60px; }
main h1 { font-size: 23px; font-weight: 400; margin: 0 0 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
main h1 small { font-size: 13px; color: var(--wp-muted); }

/* ---- 部品 ---- */
.btn { display: inline-block; padding: 5px 12px; border: 1px solid var(--wp-blue); border-radius: 3px; background: #f6f7f7; color: var(--wp-blue); cursor: pointer; text-decoration: none; line-height: 1.6; white-space: nowrap; }
.btn:hover { background: #f0f6fc; border-color: var(--wp-blue-d); color: var(--wp-blue-d); }
.btn.primary { background: var(--wp-blue); color: #fff; }
.btn.primary:hover { background: var(--wp-blue-d); }
.btn.primary:disabled { background: #a7aaad; border-color: #a7aaad; cursor: not-allowed; }
.btn.danger { color: var(--wp-red); border-color: var(--wp-red); }
.btn.small { padding: 2px 8px; font-size: 12px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.box { background: #fff; border: 1px solid var(--wp-border); padding: 14px 16px; margin-bottom: 16px; }
.box h3 { margin: -14px -16px 12px; padding: 8px 16px; font-size: 14px; border-bottom: 1px solid var(--wp-border); background: #fff; }
.box label { display: block; margin-bottom: 10px; font-size: 12px; color: var(--wp-muted); }
.box label input, .box label select, .box label textarea { display: block; width: 100%; margin-top: 3px; padding: 5px 8px; border: 1px solid #8c8f94; border-radius: 4px; color: var(--wp-text); font-size: 13px; }
.box .row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 12px; color: var(--wp-muted); }
.box .row b { color: var(--wp-text); }
.hint { font-size: 12px; color: var(--wp-muted); }
.err { color: var(--wp-red); white-space: pre-wrap; font-size: 12px; }
.err:empty { display: none; }
.notice { border-left: 4px solid var(--wp-blue); background: #fff; padding: 8px 12px; margin-bottom: 16px; box-shadow: 0 1px 1px rgba(0,0,0,.04); }
.notice.warn { border-color: var(--wp-yellow); }
.notice.error { border-color: var(--wp-red); }
.notice.ok { border-color: var(--wp-green); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--wp-dark); color: #fff; padding: 10px 18px; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.3); z-index: 100; max-width: 90vw; }
dialog { border: 1px solid var(--wp-border); border-radius: 4px; padding: 0; width: min(860px, 94vw); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog .dlg-head { display: flex; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--wp-border); font-weight: 600; }
dialog .dlg-body { padding: 16px; max-height: 70vh; overflow: auto; }
dialog .dlg-foot { padding: 10px 16px; border-top: 1px solid var(--wp-border); display: flex; gap: 8px; justify-content: flex-end; }
dialog textarea { width: 100%; min-height: 320px; font: 12px/1.5 ui-monospace, Consolas, monospace; padding: 8px; border: 1px solid #8c8f94; border-radius: 4px; }

/* ---- 法人・店舗の選択 ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid var(--wp-border); padding: 14px 16px; }
.card h2 { font-size: 16px; margin: 0 0 8px; }
.card .stores { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- 投稿一覧 ---- */
.wp-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--wp-border); }
.wp-table th, .wp-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--wp-border); vertical-align: top; }
.wp-table th { font-weight: 400; color: var(--wp-muted); background: #fff; }
.wp-table tr:hover td { background: #f6f7f7; }
.wp-table .title a { font-weight: 600; text-decoration: none; }
.wp-table .rowactions { font-size: 12px; color: var(--wp-muted); margin-top: 2px; }
.wp-table .rowactions a { margin-right: 8px; }
.wp-table .rowactions .del { color: var(--wp-red); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; background: #dcdcde; }
.badge.s-公開済み { background: #d1f0d8; color: #0a5a1e; }
.badge.s-公開待ち { background: #d5e7f5; color: #0a4b78; }
.badge.s-反映待ち, .badge.s-更新待ち { background: #fbecc4; color: #6b4a00; }
.badge.s-変換中 { background: #e0e0ff; color: #2b2b8a; }
.badge.s-検証NG { background: #f8d7d7; color: #8a1f1f; }
.badge.s-予約 { background: #efe3f7; color: #4b2a6b; }
.table-wrap { overflow-x: auto; }
.list-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }

/* ---- エディタ ---- */
.editor { display: flex; gap: 20px; align-items: flex-start; }
.ed-main { flex: 1; min-width: 0; }
.ed-side { width: 300px; flex: none; }
.ed-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ed-head h1 { margin: 0; }
input.title { width: 100%; font-size: 1.7em; padding: 6px 10px; border: 1px solid #8c8f94; border-radius: 4px; background: #fff; margin-bottom: 8px; }
.toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: #fff; border: 1px solid var(--wp-border); border-bottom: 0; padding: 6px 8px; }
.toolbar button { padding: 3px 10px; border: 1px solid var(--wp-border); background: #f6f7f7; border-radius: 3px; cursor: pointer; }
.toolbar button:hover { border-color: var(--wp-blue); color: var(--wp-blue); }
.toolbar label { font-size: 12px; color: var(--wp-muted); }
.split { display: flex; border: 1px solid var(--wp-border); background: #fff; min-height: 420px; }
.split textarea { flex: 1; min-width: 0; border: 0; padding: 12px; resize: vertical; min-height: 420px; font: 14px/1.7 ui-monospace, Consolas, "Noto Sans JP", monospace; outline: none; }
.split .preview { flex: 1; min-width: 0; border-left: 1px solid var(--wp-border); padding: 12px 16px; overflow: auto; background: #fafafa; }
.split.nopreview .preview { display: none; }
.preview h2 { font-size: 17px; margin: 14px 0 6px; padding-bottom: 4px; border-bottom: 2px solid #ddd; }
.preview p { margin: 0 0 10px; font-size: 14px; line-height: 1.8; }
.preview figure { margin: 8px 0 14px; }
.preview img { max-width: 100%; height: auto; display: block; }
.preview figcaption { font-size: 12px; color: var(--wp-muted); }
.preview .ph { border: 1px dashed #8c8f94; color: var(--wp-muted); padding: 10px; margin: 8px 0; font-size: 12px; background: #fff; }
.preview mark { background: #ffb3b3; padding: 0 2px; }
#ngBox:not(:empty) { border: 1px solid var(--wp-red); border-top: 0; background: #fcf0f1; padding: 8px 12px; color: var(--wp-red); font-size: 12px; }
#ngBox ul { margin: 4px 0 0; padding-left: 18px; }
.slots { list-style: none; margin: 0; padding: 0; }
.slots li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid #eee; }
.slots li:last-child { border-bottom: 0; }
.slots .tag { font-size: 11px; padding: 1px 6px; border-radius: 3px; background: #fbecc4; color: #6b4a00; }
.slots .tag.ext { background: #d5e7f5; color: #0a4b78; }
.slots .tag.ok { background: #d1f0d8; color: #0a5a1e; }
.slots .what { flex: 1; min-width: 160px; word-break: break-all; }
.slots img.thumb { width: 56px; height: 40px; object-fit: cover; border: 1px solid var(--wp-border); }
.url { font-size: 11px; color: var(--wp-muted); word-break: break-all; margin: -6px 0 10px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0 8px; }
.after { font-size: 12px; }
.after a { display: block; margin: 4px 0; word-break: break-all; }

/* ---- メディア ---- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media-grid .item { background: #fff; border: 1px solid var(--wp-border); padding: 6px; cursor: pointer; font-size: 11px; word-break: break-all; }
.media-grid .item:hover { border-color: var(--wp-blue); }
.media-grid img { width: 100%; height: 110px; object-fit: cover; display: block; margin-bottom: 4px; background: #eee; }

@media (max-width: 900px) {
  .editor { flex-direction: column; }
  .ed-side { width: 100%; }
  .split { flex-direction: column; }
  .split .preview { border-left: 0; border-top: 1px solid var(--wp-border); }
}
@media (max-width: 782px) {
  .menu { width: auto; }
  .menu a { padding: 10px 10px; font-size: 12px; }
  .menu .sub { padding-left: 10px; }
  .topbar { gap: 8px; }
  .topbar .sel span, .deploy-info, .topbar .who, .topbar .pw { display: none; }
  .topbar select { max-width: 130px; }
  main { padding: 12px 12px 60px; }
}

/* ---- アイキャッチ・下書き（2026-09-15 追加） ---- */
.thumb-field { margin-bottom: 10px; }
.thumb-field .lbl { display: block; font-size: 12px; color: var(--wp-muted); margin-bottom: 4px; }
.thumb-preview { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid var(--wp-border); background: #eee; margin-bottom: 4px; }
.badge.s-下書き { background: #e9e9ea; color: #3c434a; }
#saveErr.busy { color: var(--wp-muted); }

/* ---- 店舗情報フォーム（2026-09-16 追加） ---- */
.sf-field { margin: 0 0 10px; }
.sf-field .sf-label { display: block; font-size: 12px; color: var(--wp-muted); margin-bottom: 3px; }
.sf-field input[type="text"], .sf-field input[type="date"], .sf-field input[type="number"], .sf-field select, .sf-field textarea { padding: 5px 8px; border: 1px solid #8c8f94; border-radius: 4px; font-size: 13px; color: var(--wp-text); background: #fff; max-width: 100%; }
.sf-field textarea { width: 100%; font-family: inherit; }
.sf-field .hint { display: block; margin-top: 2px; }
.sf-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.sf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.sf-ro { font-size: 13px; color: var(--wp-muted); margin-bottom: 12px; }
.cal { display: grid; grid-template-columns: repeat(7, 40px); gap: 4px; margin: 6px 0 4px; }
.cal-w { font-size: 11px; color: var(--wp-muted); text-align: center; }
.cal-d { display: block; text-align: center; padding: 6px 0; border: 1px solid var(--wp-border); border-radius: 4px; cursor: pointer; font-size: 13px; background: #fff; user-select: none; }
.cal-d input { display: none; }
.cal-d.on { background: var(--wp-red); color: #fff; border-color: var(--wp-red); }
.verified-list { font-size: 12px; color: var(--wp-muted); }
.verified-list b { color: var(--wp-text); font-variant-numeric: tabular-nums; }

/* ---- アクセス（2026-09-16 追加） ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--wp-border); padding: 10px 14px; }
.kpi span { display: block; font-size: 12px; color: var(--wp-muted); }
.kpi b { display: block; font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 12px; color: var(--wp-muted); }
.kpi small.up { color: var(--wp-green); }
.kpi small.down { color: var(--wp-red); }
.chart { width: 100%; height: auto; display: block; background: #fff; }
.an-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.an-cols .box { margin-bottom: 0; }
.an-cols + .box { margin-top: 16px; }

/* ---- 同期状況・ユーザー（2026-09-16 追加） ---- */
.usr-form label { display: block; margin-bottom: 10px; font-size: 12px; color: var(--wp-muted); }
.usr-form label input, .usr-form label select { display: block; width: 100%; margin-top: 3px; padding: 5px 8px; border: 1px solid #8c8f94; border-radius: 4px; font-size: 13px; color: var(--wp-text); }
.g-tenant { border: 1px solid var(--wp-border); padding: 8px 10px; margin-bottom: 8px; }
.g-tenant > label { margin-bottom: 4px; }
.g-tenant select { width: auto !important; display: inline-block !important; margin-left: 8px; }
.g-stores { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 4px 0 0; }
.g-stores label { display: inline; font-size: 13px; color: var(--wp-text); }
.pw-show { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.pw-show code { font-size: 18px; padding: 6px 12px; background: var(--wp-bg); border: 1px solid var(--wp-border); user-select: all; }
