:root { --teal: #0d9488; --ink: #0f172a; --bg: #f1f5f9; --line: #e2e8f0; }
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Noto Sans JP', sans-serif; background: var(--bg); color: var(--ink); }
.topbar { display: flex; justify-content: space-between; align-items: center; background: #fff; border-bottom: 1px solid var(--line); padding: 0.75rem 1.25rem; }
.brand { font-weight: 700; font-size: 1.05rem; }
.brand span { color: var(--teal); }
.main { max-width: 1200px; margin: 2rem auto; padding: 0 1rem; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.5rem; }
.card-narrow { max-width: 420px; margin: 3rem auto; }
label { display: block; margin: 0.75rem 0; font-size: 0.9rem; }
input[type=text], input[type=password] { width: 100%; padding: 0.6rem; margin-top: 0.25rem; border: 1px solid var(--line); border-radius: 6px; font-size: 1rem; }
.btn { padding: 0.55rem 1.2rem; border-radius: 6px; border: 1px solid transparent; font-size: 0.95rem; cursor: pointer; }
.btn-primary { background: var(--teal); color: #fff; width: 100%; margin-top: 0.75rem; }
.btn-ghost-bordered { background: #fff; color: var(--ink); border-color: var(--line); } /* 「押せる」ことは枠線で示す */
.alert { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: 0.6rem 0.8rem; border-radius: 6px; font-size: 0.9rem; }

/* --- Plan B: 一覧・編集・クライアント管理 --- */
.nav-links { display: flex; gap: 0.75rem; align-items: center; }
.nav-links a { color: var(--ink); text-decoration: none; font-size: 0.9rem; padding: 0.3rem 0.6rem; border-radius: 6px; }
.nav-links a:hover { background: var(--bg); }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 1rem; }
.page-head h1 { margin: 0; font-size: 1.3rem; }
.btn-auto { width: auto; margin-top: 0; display: inline-block; text-decoration: none; text-align: center; }
.mt { margin-top: 1rem; }
.muted { color: #94a3b8; }
.small { font-size: 0.8rem; }
.hint { display: block; font-size: 0.78rem; color: #64748b; margin-top: 0.2rem; font-weight: 400; }
.num { text-align: right; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table thead th { font-size: 0.8rem; color: #64748b; font-weight: 500; }
.row-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.row-actions form { display: inline; margin: 0; }
.btn-mini { padding: 0.25rem 0.6rem; font-size: 0.8rem; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-danger { color: #b91c1c; border-color: #fecaca; }
.alert-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.status-badge { font-size: 0.85rem; font-weight: 400; margin-left: 0.5rem; }
.main > .alert { margin-bottom: 1rem; }
select, textarea { width: 100%; padding: 0.6rem; margin-top: 0.25rem; border: 1px solid var(--line); border-radius: 6px; font-size: 1rem; font-family: inherit; background: #fff; }
/* 編集2ペイン */
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
@media (max-width: 900px) { .editor-grid { grid-template-columns: 1fr; } }
.editor-pane textarea { min-height: 480px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.85rem; }
textarea[name=custom_head_tags] { min-height: 80px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.85rem; }
.preview-pane { border: 1px solid var(--line); border-radius: 6px; background: #fff; display: flex; flex-direction: column; overflow: hidden; }
.preview-tools { display: flex; gap: 0.35rem; align-items: center; padding: 0.4rem; border-bottom: 1px solid var(--line); }
#preview { flex: 1; width: 100%; min-height: 480px; border: 0; background: #fff; margin: 0 auto; display: block; }
#preview.preview-sp { width: 390px; max-width: 100%; }
.editor-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1rem; }
.editor-actions .btn { width: auto; margin-top: 0; }
/* テンプレート選択 */
.tpl-picker { border: 1px solid var(--line); border-radius: 6px; padding: 0.75rem; margin: 0.75rem 0; }
.tpl-card { display: block; padding: 0.5rem; border: 1px solid var(--line); border-radius: 6px; margin: 0.4rem 0; cursor: pointer; }
/* 確認モーダル */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); align-items: center; justify-content: center; z-index: 50; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 10px; padding: 1.5rem; max-width: 420px; width: calc(100% - 2rem); }
.modal-msg { margin: 0; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.25rem; }
.modal-actions .btn { width: auto; margin-top: 0; }
