:root {
  --blue: #1a6dff;
  --blue-dark: #0b4fd1;
  --blue-soft: #eaf1ff;
  --ink: #10151f;
  --muted: #667085;
  --line: #e3e8ef;
  --bg: #f6f8fb;
  --ok: #12a150;
  --warn: #e8590c;
  --danger: #d92d20;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------- ヘッダー ------------------------------- */
header.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
}
header.top .brand {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  color: var(--ink);
  text-decoration: none;
}
header.top .brand:hover { text-decoration: none; }
header.top .brand .brand-owner {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
}
header.top .brand .brand-name { font-size: 17px; font-weight: 800; letter-spacing: .02em; }
header.top .brand .brand-name em { font-style: normal; color: var(--blue); }
header.top nav { display: flex; gap: 4px; margin-left: 8px; }
header.top nav a {
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  color: var(--muted);
}
header.top nav a:hover { background: var(--blue-soft); text-decoration: none; }
header.top nav a.active { background: var(--blue); color: #fff; }
header.top .spacer { flex: 1; }
header.top .who { font-size: 13px; color: var(--muted); text-align: right; line-height: 1.3; }
header.top .who b { display: block; color: var(--ink); font-size: 14px; }

.bell {
  position: relative;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}
.bell .badge {
  position: absolute;
  top: -6px; right: -6px;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  padding: 1px 6px;
  font-weight: 800;
}
.notif-panel {
  position: absolute;
  right: 16px; top: 56px;
  width: min(420px, calc(100vw - 32px));
  max-height: 60vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(16,21,31,.14);
  z-index: 30;
}
.notif-panel .row { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.notif-panel .row.unread { background: var(--blue-soft); }
.notif-panel .row time { display: block; color: var(--muted); font-size: 11px; }

/* -------------------------------- レイアウト ------------------------------- */
main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }
h1 { font-size: 22px; font-weight: 800; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 800; margin: 28px 0 10px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* -------------------------------- パーツ -------------------------------- */
button, .btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
  cursor: pointer;
}
button:hover, .btn:hover { border-color: #c9d2e0; text-decoration: none; }
button.primary, .btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
button.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
button.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 4px 8px; font-size: 13px; }
button.ghost:hover { background: #eef2f7; }
button:disabled { opacity: .5; cursor: not-allowed; }

input[type=text], input[type=email], input[type=password], input[type=date], textarea, select {
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
textarea { line-height: 1.8; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }

.badge-status {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.st-draft { background: #eef2f7; color: #475467; }
.st-review { background: #fff4e5; color: var(--warn); }
.st-changes { background: #fee4e2; color: var(--danger); }
.st-approved { background: #e7f7ee; color: var(--ok); }

.tag { font-size: 11px; font-weight: 700; color: var(--muted); background: #eef2f7; border-radius: 4px; padding: 1px 6px; }
.empty { color: var(--muted); padding: 28px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); background: #fff; }
.error { background: #fee4e2; color: #912018; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.notice { background: var(--blue-soft); color: var(--blue-dark); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }

/* -------------------------------- 一覧 -------------------------------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button {
  border: none; background: none; border-bottom: 3px solid transparent;
  border-radius: 0; padding: 10px 14px; color: var(--muted);
}
.tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.post-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.post-card:hover { border-color: var(--blue); box-shadow: 0 6px 20px rgba(26,109,255,.10); }
.post-card .thumb { aspect-ratio: 1; background: #eef2f7 center/cover no-repeat; display: block; }
.post-card .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.post-card .title { font-weight: 800; line-height: 1.4; }
.post-card .meta { font-size: 12px; color: var(--muted); }

table.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: middle; }
table.list th { background: #fafbfd; font-size: 12px; color: var(--muted); font-weight: 800; }
table.list tr:last-child td { border-bottom: none; }
table.list tr:hover td { background: #fafcff; }

/* ------------------------------- 投稿詳細 ------------------------------- */
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
@media (max-width: 940px) { .post-layout { grid-template-columns: 1fr; } }

.img-item { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; margin-bottom: 16px; }
.img-item.selected { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(26,109,255,.18); }
.img-item img { width: 100%; display: block; background: #f0f3f8; }
.img-item .bar { padding: 8px 12px; display: flex; align-items: center; gap: 8px; justify-content: space-between; font-size: 13px; border-top: 1px solid var(--line); }
.img-item .bar .count { font-weight: 800; color: var(--blue); }

.thread { border-top: 1px solid var(--line); padding: 12px; background: #fbfcfe; }
.comment { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.comment:last-child { border-bottom: none; }
.comment .head { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.comment .head b { color: var(--ink); font-size: 13px; }
.comment .body-text { white-space: pre-wrap; margin-top: 2px; }
.comment.reply { margin-left: 20px; padding-left: 12px; border-left: 3px solid var(--blue-soft); }
.comment.resolved { opacity: .55; }
.comment-form { display: flex; gap: 8px; margin-top: 8px; }
.comment-form textarea { min-height: 42px; }

/* ------------------------------- 校閲ビュー ------------------------------ */
.blocks { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 6px; }
.block {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px;
  padding: 6px 10px; border-radius: 8px; align-items: start;
}
.block:hover { background: #f7faff; }
.block.changed { background: #fffaf2; }
.block .num { color: var(--muted); font-size: 12px; font-weight: 700; padding-top: 4px; text-align: right; user-select: none; }
.block .text { white-space: pre-wrap; word-break: break-word; }
.block .text.h1, .block .text.h2, .block .text.h3, .block .text.h4 { font-weight: 800; }
.block .text.h1 { font-size: 22px; }
.block .text.h2 { font-size: 19px; border-left: 4px solid var(--blue); padding-left: 10px; }
.block .text.h3 { font-size: 17px; }
.block .text.li { padding-left: 1.2em; text-indent: -1.2em; }
.block .tools { display: flex; gap: 4px; margin-top: 4px; align-items: center; opacity: .18; transition: opacity .12s; }
.block:hover .tools, .block.active .tools, .block .tools.pinned { opacity: 1; }
.block .tools .has-comment { color: var(--blue); font-weight: 800; }
.block .tools .has-open { color: var(--warn); font-weight: 800; }
.block .marker { font-size: 11px; font-weight: 800; color: var(--warn); }
.block-img img {
  max-width: min(100%, 460px);
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f0f3f8;
  display: block;
}

ins { background: #dcf5e6; color: #05603a; text-decoration: none; border-bottom: 2px solid var(--ok); }
del { background: #ffe9e6; color: #912018; }

.rev-row { font-size: 13px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.rev-row .who { color: var(--muted); font-size: 12px; }
.rev-row .before { color: #912018; background: #ffe9e6; padding: 2px 4px; border-radius: 4px; }
.rev-row .after { color: #05603a; background: #dcf5e6; padding: 2px 4px; border-radius: 4px; }

/* ------------------------------- ログイン ------------------------------- */
.login-wrap { max-width: 380px; margin: 12vh auto; }
.login-wrap .card { padding: 28px; }
.login-wrap h1 { text-align: center; margin-bottom: 20px; }

.hidden { display: none !important; }
