/* 編集画面・管理画面・ログインの見た目（公開ページは page.css） */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
    --ink: #1c1c1e; --sub: #6b6b72; --line: #dcdce2; --bg: #f4f4f7; --card: #fff;
    --accent: #2f5bea; --accent-ink: #fff; --bad: #c62828; --ok: #1b7f4b;
}
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
    margin: 0; background: var(--bg); color: var(--ink); line-height: 1.6; font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
}
h1 { font-size: 1.25rem; margin: 0 0 8px; }
h2 { font-size: 1rem; margin: 0 0 10px; }
p { margin: 0 0 10px; }
.muted { color: var(--sub); }
.small { font-size: .82rem; }
.pad { padding: 16px; }
.grow { flex: 1; }
.err { color: var(--bad); font-size: .88rem; }

body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.card.narrow { width: 100%; max-width: 380px; padding: 24px; }

label { display: block; font-size: .82rem; color: var(--sub); margin-bottom: 10px; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=url], input[type=password], input:not([type]), select, textarea {
    display: block; width: 100%; margin-top: 3px; padding: 9px 10px; min-height: 42px;
    border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 1px;
}
input.bad { border-color: var(--bad); }
input[type=color] { width: 46px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; vertical-align: middle; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; vertical-align: -3px; margin: 0 6px 0 0; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 40px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 8px;
    background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f0f0f4; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--bad); border-color: #e7b9b9; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: .85rem; }
.btn.icon { min-width: 40px; padding: 6px; }
.btn.wide { width: 100%; margin-top: 6px; }

.top {
    position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line);
}
.top select { width: auto; max-width: 46vw; margin: 0; min-height: 36px; padding: 4px 8px; }
.brand { font-size: .95rem; white-space: nowrap; }

.pubbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line);
}
.puburl { color: var(--accent); font-size: .88rem; overflow-wrap: anywhere; min-width: 0; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .75rem; font-weight: 700; background: #e9e9ee; color: var(--sub); white-space: nowrap; }
.badge.on { background: #dff3e7; color: var(--ok); }
.badge.off { background: #fde8e8; color: var(--bad); }

.cols { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 1120px; margin: 0 auto; }
.editor { min-width: 0; padding: 12px 12px 80px; }
.preview { display: none; }
@media (min-width: 980px) {
    .cols { grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; padding: 0 16px; }
    .preview { display: block; position: sticky; top: 64px; align-self: start; padding-top: 12px; }
    .phone { height: min(720px, calc(100vh - 130px)); border: 8px solid #1c1c1e; border-radius: 34px; overflow: hidden; background: #fff; }
    .phone iframe { width: 100%; height: 100%; border: 0; display: block; }
}

.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.tabs button {
    flex: 1 1 auto; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px;
    background: #fff; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected=true] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }

.section { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row.end { justify-content: flex-end; }
.addbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
@media (min-width: 560px) { .addbar { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.block { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.block.off { background: #f1f1f4; }
.block-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.block-head .kind { font-weight: 700; font-size: .85rem; }
.block-head label { margin: 0; white-space: nowrap; color: var(--ink); }
.thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); background: #f1f1f4; flex: none; }
.thumb.round { border-radius: 50%; width: 72px; height: 72px; }
.thumb.empty { display: grid; place-items: center; color: var(--sub); font-size: .7rem; }
.hint { font-size: .78rem; color: var(--sub); margin: -4px 0 10px; }

.sns-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sns-row .ic { flex: none; width: 28px; display: grid; place-items: center; color: var(--sub); }
.sns-row input { margin: 0; }

.presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.preset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px 6px; cursor: pointer; text-align: center; font-size: .75rem; min-height: 72px; }
.preset .pill { display: block; height: 16px; margin: 0 6px 8px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.colors label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; color: var(--ink); font-size: .88rem; }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.kpi b { display: block; font-size: 1.4rem; line-height: 1.2; }
.kpi span { font-size: .78rem; color: var(--sub); }

.tablewrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.list th, table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: middle; }
table.list th { font-size: .78rem; color: var(--sub); font-weight: 600; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list td.wrap { white-space: normal; min-width: 160px; overflow-wrap: anywhere; }

.dlg { width: min(440px, calc(100vw - 24px)); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.dlg::backdrop { background: rgba(0, 0, 0, .4); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; user-select: all; word-break: break-all; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 10px 0 14px; align-items: baseline; }

.toast {
    position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); z-index: 20;
    max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px;
    background: #1c1c1e; color: #fff; font-size: .88rem; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); }

.adminwrap { max-width: 1120px; margin: 0 auto; padding: 12px 12px 80px; }
.formgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
@media (min-width: 720px) { .formgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; } }
