* { box-sizing: border-box; }
body {
  margin: 0; background: #f1f3f6; color: #1f2937;
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  font-size: 14px; line-height: 1.7;
}
.wrap { width: 780px; max-width: 100%; margin: 0 auto; padding: 0 16px 48px; }

/* nav（全ページ共通・上部固定。ページ幅に依存しないので位置がズレない） */
nav { background: #1e293b; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 6px rgba(15, 23, 42, .25); }
nav .nav-inner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; padding: 0 24px; }
nav .brand { color: #fff; font-weight: bold; padding: 13px 0; font-size: 15px; white-space: nowrap; letter-spacing: .02em; }
nav .nav-menu { display: flex; justify-content: center; flex-wrap: wrap; }
nav a { color: #cbd5e1; text-decoration: none; padding: 13px 17px; font-size: 13px; white-space: nowrap; letter-spacing: .08em; position: relative; display: flex; align-items: center; gap: 6px; }
nav .nav-menu svg.ic { width: 14px; height: 14px; opacity: .85; }
nav a:hover { color: #fff; }
nav a.active { color: #fff; box-shadow: inset 0 -3px 0 #38bdf8; }
/* 項目間の区切り縦線（上下中央に短く） */
nav .nav-menu a + a::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 1px; height: 14px; background: rgba(148, 163, 184, .45); }
nav .nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; padding: 8px 0; }
nav .login-status { color: #94a3b8; font-size: 12px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
nav .login-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; display: inline-block; flex: none; }
nav .logout-btn { border: 1px solid #64748b; color: #e2e8f0; background: transparent; border-radius: 999px; padding: 5px 16px; font-size: 12px; font-family: inherit; cursor: pointer; white-space: nowrap; }
nav .logout-btn:hover { background: #334155; border-color: #94a3b8; }

h1 { font-size: 20px; margin: 26px 0 16px; }
h2 { font-size: 15px; margin: 22px 0 10px; }

.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 20px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.stat { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px 16px; }
.stat .num { font-size: 26px; font-weight: bold; }
.stat .label { font-size: 12px; color: #64748b; }

label { display: block; font-size: 12px; color: #475569; margin: 12px 0 4px; font-weight: bold; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number],
input[type=datetime-local], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px;
  font-size: 14px; font-family: inherit; background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: #60a5fa; }

/* ボタンはピル型（入力欄=角丸小さめの四角、と形で区別できるように） */
button, .btn {
  display: inline-block; padding: 8px 20px; border: 0; border-radius: 999px; cursor: pointer;
  background: #2563eb; color: #fff; font-size: 13px; font-weight: bold; font-family: inherit;
  text-decoration: none; line-height: 1.6;
}
button:hover, .btn:hover { background: #1d4ed8; }
button.ghost, .btn.ghost { background: #fff; color: #334155; border: 1px solid #cbd5e1; }
button.ghost:hover { background: #f1f5f9; }
button.danger { background: #dc2626; }
button.danger:hover { background: #b91c1c; }
button:disabled { opacity: .5; cursor: default; }
.btn-sm { padding: 4px 14px; font-size: 12px; }

table.list { width: 100%; border-collapse: collapse; background: #fff; }
table.list th, table.list td { padding: 8px 10px; border-bottom: 1px solid #e2e8f0; text-align: left; font-size: 13px; }
table.list th { background: #f8fafc; color: #475569; font-size: 12px; white-space: nowrap; }
table.list tr:hover td { background: #f8fafc; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: bold; }
.badge.done { background: #dcfce7; color: #166534; }
.badge.sending { background: #dbeafe; color: #1e40af; }
.badge.scheduled { background: #fef9c3; color: #854d0e; }
.badge.error, .badge.canceled { background: #fee2e2; color: #991b1b; }
.badge.sent { background: #dcfce7; color: #166534; }
.badge.pending { background: #e2e8f0; color: #475569; }
.badge.grp { background: #e0e7ff; color: #3730a3; }

/* 画面右下のトースト通知（スクロール位置に関係なく必ず見える） */
#toast-box { position: fixed; right: 20px; bottom: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; padding: 12px 20px; border-radius: 999px;
  font-size: 14px; font-weight: bold; color: #fff; background: #16a34a;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .28); opacity: 0; transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease; max-width: 460px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: #dc2626; }
.toast .ti { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 50%; background: rgba(255, 255, 255, .25); font-size: 13px; flex: none; }

.muted { color: #64748b; font-size: 12px; }
.msg { padding: 10px 14px; border-radius: 6px; margin: 12px 0; font-size: 13px; display: none; }
.msg.ok { display: block; background: #dcfce7; color: #166534; }
.msg.err { display: block; background: #fee2e2; color: #991b1b; }
.notice { background: #fef9c3; color: #854d0e; padding: 10px 14px; border-radius: 6px; font-size: 13px; margin: 12px 0; }

.toolbar { display: flex; gap: 8px; align-items: center; margin: 14px 0; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; }
.right { margin-left: auto; }

iframe.preview { width: 100%; height: 640px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; }

/* エディタ上部ツールバー（保存ボタン等）をナビ直下に固定 */
.editor-toolbar { position: sticky; top: 48px; z-index: 60; background: rgba(241, 243, 246, .96);
  backdrop-filter: blur(4px); padding: 10px 0; margin: 0 0 12px; }

/* 選択中ブロックの強調（編集リスト側） */
.block.selected { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, .25); }

/* エディタ2カラム（編集=左 / プレビュー=右固定） */
.wide .wrap { width: 1340px; }
.editor-cols { display: flex; gap: 20px; align-items: flex-start; }
.ed-left { flex: 1 1 0; min-width: 0; }
.ed-right { width: 648px; flex: none; position: sticky; top: 12px; }
.ed-right iframe.preview { height: calc(100vh - 90px); }
.ed-right h2 { margin-top: 0; }
@media (max-width: 1160px) {
  .editor-cols { display: block; }
  .ed-right { width: auto; position: static; }
  .ed-right iframe.preview { height: 640px; }
  .ed-right h2 { margin-top: 22px; }
}

/* スタイル設定 */
.color-field { display: flex; gap: 6px; align-items: center; }
.color-field input[type=color] { width: 38px; height: 36px; padding: 2px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; cursor: pointer; }
.color-field input[type=text] { flex: 1; }
.style-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e2e8f0; }

/* 全体スタイルの折りたたみパネル */
details.style-panel { padding: 12px 20px; }
details.style-panel summary { cursor: pointer; font-weight: bold; font-size: 13px; color: #334155; user-select: none; }
details.style-panel summary:hover { color: #1d4ed8; }
details.style-panel[open] { padding-bottom: 20px; }
details.style-panel .grid2 { gap: 12px; }

/* 言語タブ */
.lang-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.lang-tabs button { background: #e2e8f0; color: #475569; border: 1px solid #cbd5e1; border-radius: 8px 8px 0 0;
  padding: 8px 20px; font-size: 13px; font-weight: normal; }
.lang-tabs button:hover { background: #eef2ff; }
.lang-tabs button.active { background: #1e293b; color: #fff; border-color: #1e293b; font-weight: bold; }

/* ブロックエディタ */
.block { border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 10px; background: #fbfcfe; }
.block-head { display: flex; align-items: center; gap: 5px; padding: 7px 10px; background: #f1f5f9; border-bottom: 1px solid #e2e8f0; border-radius: 8px 8px 0 0; }
.block-head .type { font-size: 13px; font-weight: bold; color: #334155; margin-right: auto; }
.block-head button { padding: 4px 10px; font-size: 12px; background: #fff; color: #334155; border: 1px solid #cbd5e1; font-weight: normal; white-space: nowrap; }
.block-head button:hover { background: #eef2ff; }
.block-head button:disabled { opacity: .35; }
.block-head button.del-btn { color: #b91c1c; border-color: #fca5a5; }
.block-head button.del-btn:hover { background: #fee2e2; }
.block-body { padding: 12px 14px; }

/* セクション（まとまり） */
.block.section-block { border: 1.5px solid #94a3b8; background: #f5f7fb; }
.section-block > .block-head { background: #e8edf5; }
.section-body { padding: 12px 14px; }
.section-title { margin-bottom: 10px; font-size: 13px; }
.section-children { border-left: 3px solid #cbd5e1; padding-left: 12px; margin: 2px 0 10px; }
.section-children .block { background: #fff; }
.section-empty { color: #94a3b8; font-size: 12px; padding: 14px; border: 1.5px dashed #cbd5e1; border-radius: 8px; text-align: center; }
.section-children.drop-into { outline: 2px dashed #2563eb; outline-offset: 2px; border-radius: 6px; }
.add-inline-title { font-size: 12px; font-weight: bold; color: #475569; margin: 4px 0 6px; }
.palette.small button { padding: 6px 12px; font-size: 12px; }
.palette.small .p-icon svg.ic { width: 14px; height: 14px; }

/* ドラッグ並べ替え（編集リスト側） */
.block-head { cursor: grab; }
.block-head:active { cursor: grabbing; }
.grip { color: #94a3b8; font-size: 13px; letter-spacing: -3px; margin-right: 8px; user-select: none; }
.block.dragging { opacity: .45; }
.block.drop-before { box-shadow: 0 -3px 0 0 #2563eb; }
.block.drop-after { box-shadow: 0 3px 0 0 #2563eb; }

/* ブロック追加エリア */
.add-block-box { border: 2px dashed #cbd5e1; border-radius: 10px; padding: 12px 14px 14px; background: #f8fafc; margin-top: 12px; }
.add-block-title { font-size: 13px; font-weight: bold; color: #475569; margin-bottom: 10px; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.palette button { background: #fff; border: 1px solid #cbd5e1; color: #1f2937; font-weight: normal; padding: 9px 14px; font-size: 13px; border-radius: 999px; display: flex; align-items: center; gap: 7px; box-shadow: 0 1px 2px rgba(15,23,42,.06); }
.palette button:hover { background: #eff6ff; border-color: #2563eb; }
.palette .p-icon { line-height: 1; display: inline-flex; }

/* モノトーンSVGアイコン（全OSで同一表示） */
svg.ic { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; flex: none; }
.palette .p-icon svg.ic { width: 17px; height: 17px; color: #475569; }
.block-head .type svg.ic { margin-right: 7px; color: #475569; }
details.style-panel summary svg.ic { vertical-align: -3px; margin-right: 4px; color: #475569; }
#btn-translate svg.ic { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
nav .brand svg.ic { width: 17px; height: 17px; vertical-align: -3px; }
.login-box { max-width: 360px; margin: 90px auto; }
.thumb { height: 34px; width: auto; border: 1px solid #e2e8f0; border-radius: 4px; }
