* { box-sizing: border-box; }
body {
  margin: 0; background: #f6f7f9; color: #1c2433;
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-size: 14px; line-height: 1.7;
}
header {
  display: flex; align-items: center; gap: 16px;
  background: #fff; border-bottom: 1px solid #dde1e8; padding: 10px 20px;
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 16px; }
#clientSelect { padding: 6px 10px; border: 1px solid #dde1e8; border-radius: 6px; background: #fff; font-size: 13px; }
nav { display: flex; gap: 4px; margin-left: auto; }
nav button {
  border: none; background: none; padding: 8px 12px; cursor: pointer;
  font-size: 13px; color: #5a6472; border-radius: 6px;
}
nav button.active { background: #fdeeec; color: #c93d2e; font-weight: 700; }

main { max-width: 960px; margin: 0 auto; padding: 24px 20px 80px; }
.tab { display: none; }
.tab.active { display: block; }
.row-head { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px; }
.row-head:first-child { margin-top: 0; }
h2 { font-size: 17px; margin: 0; }
.hint { color: #5a6472; font-size: 13px; }

button.primary {
  background: #c93d2e; color: #fff; border: none; border-radius: 6px;
  padding: 8px 16px; font-size: 13px; cursor: pointer; font-weight: 700;
}
button.primary:disabled { opacity: .5; cursor: wait; }
button.ghost {
  background: #fff; border: 1px solid #dde1e8; border-radius: 6px;
  padding: 6px 12px; font-size: 12.5px; cursor: pointer; color: #1c2433;
}
#addBenchBtn { composes: ghost; }

.card {
  background: #fff; border: 1px solid #dde1e8; border-radius: 8px;
  padding: 14px 16px; margin-bottom: 10px;
}
.card .meta { font-size: 12px; color: #8a92a0; }
.card h3 { font-size: 14.5px; margin: 0 0 4px; }
.card p { margin: 4px 0; font-size: 13px; color: #5a6472; }
.card .actions { display: flex; gap: 8px; margin-top: 10px; }

.tag {
  display: inline-block; background: #eceef2; color: #5a6472;
  font-size: 11px; padding: 1px 8px; border-radius: 3px; margin-right: 4px;
}
.tag.platform { background: #fdeeec; color: #b23325; font-weight: 700; }
.tag.standout { background: #fff4d6; color: #8a6d1a; font-weight: 700; }

.calendar { display: grid; gap: 6px; }
.slot {
  display: flex; gap: 12px; align-items: baseline; background: #fff;
  border: 1px solid #dde1e8; border-radius: 6px; padding: 8px 14px; font-size: 13px;
}
.slot .when { font-family: ui-monospace, monospace; font-size: 12px; color: #5a6472; white-space: nowrap; }
.slot .title { flex: 1; }
.slot .status { font-size: 11px; padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.status.empty { background: #eceef2; color: #8a92a0; }
.status.planned { background: #fff4d6; color: #8a6d1a; }
.status.drafted { background: #e3edfd; color: #2b5db9; }
.status.approved { background: #e0f3e6; color: #237a3f; }

textarea, input[type=text], input[type=number], select.form {
  width: 100%; border: 1px solid #dde1e8; border-radius: 6px;
  padding: 8px 10px; font-size: 13px; font-family: inherit; background: #fff;
}
textarea { resize: vertical; }
label.field { display: block; margin: 10px 0 4px; font-size: 12.5px; color: #5a6472; font-weight: 700; }

.media-row {
  display: grid; grid-template-columns: 90px 60px 1fr; gap: 10px;
  align-items: center; background: #fff; border: 1px solid #dde1e8;
  border-radius: 6px; padding: 10px 14px; margin-bottom: 8px;
}
.media-row .pf { font-weight: 700; }

.qa-block { background: #f6f7f9; border-radius: 6px; padding: 10px 12px; margin: 8px 0; }
.qa-block .q { font-weight: 700; font-size: 13px; }

pre.draft {
  background: #f6f7f9; border: 1px solid #e8ebf0; border-radius: 6px;
  padding: 10px 12px; white-space: pre-wrap; font-family: inherit; font-size: 13px; margin: 8px 0;
}

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1c2433; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; opacity: 0; transition: opacity .3s; pointer-events: none; max-width: 90%;
}
#toast.show { opacity: 1; }

/* テーブル（KPIツリー・型別成績・事業成果） */
.tablewrap { overflow-x: auto; border: 1px solid #dde1e8; border-radius: 6px; margin: 10px 0; }
.tablewrap table { border-collapse: collapse; width: 100%; min-width: 520px; background: #fff; font-size: 13px; }
.tablewrap th, .tablewrap td {
  text-align: left; padding: 8px 12px; border-bottom: 1px solid #e8ebf0;
  vertical-align: top; line-height: 1.7;
}
.tablewrap th { font-size: 11.5px; color: #8a92a0; font-weight: 700; white-space: nowrap; background: #fafbfc; }
.tablewrap tr:last-child td { border-bottom: none; }
.tablewrap td { font-variant-numeric: tabular-nums; }

h4 { font-size: 14px; margin: 16px 0 4px; }
.card h4:first-of-type { margin-top: 10px; }

/* ── カスケードUI（PR-C）───────────────────────────────────────────────── */
.flex { flex: 1; }
header nav { margin-left: 0; }
#eventBtn { margin-left: auto; }

.cascade { display: flex; flex-direction: column; }
.cascade-arrow {
  text-align: center; color: #8a92a0; font-size: 12px; padding: 8px 0;
  letter-spacing: .04em;
}
.layer {
  background: #fff; border: 1px solid #dde1e8; border-radius: 10px; padding: 16px 18px;
}
.layer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.layer-head h2 { font-size: 15px; margin: 0; }
.layer-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: #fdeeec; color: #c93d2e; font-size: 12px; font-weight: 700;
}

/* 要対応バナー */
.attention {
  background: #fff4d6; border: 1px solid #f0dca8; border-radius: 8px;
  padding: 12px 16px; margin-bottom: 16px; font-size: 13px;
}
.attention h3 { margin: 0 0 6px; font-size: 13.5px; color: #8a6d1a; }
.attention ul { margin: 4px 0 0; padding-left: 18px; color: #6b5714; }
.attention.clear { background: #e0f3e6; border-color: #b7e0c4; color: #237a3f; }

/* 媒体レーン */
.media-lane {
  border: 1px solid #e8ebf0; border-radius: 8px; padding: 12px 14px; margin-bottom: 10px;
}
.media-lane.disabled { opacity: .5; }
.lane-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lane-head .role { font-size: 12.5px; color: #5a6472; }
.lane-kpi { font-size: 12px; color: #5a6472; margin: 6px 0 0; }
.lane-kpi b { color: #1c2433; }

.theme-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.theme-chip {
  flex: 1 1 180px; min-width: 180px; border: 1px solid #dde1e8; border-radius: 6px;
  padding: 8px 10px; cursor: pointer; background: #fafbfc; text-align: left; font: inherit;
}
.theme-chip:hover { border-color: #c93d2e; }
.theme-chip .m { font-family: ui-monospace, monospace; font-size: 11px; color: #8a92a0; }
.theme-chip .t { font-size: 13px; font-weight: 700; margin: 2px 0; }
.theme-chip.missing { border-style: dashed; color: #8a92a0; }
.theme-chip.stale { border-color: #e8a33d; background: #fffaf0; }
.theme-chip.confirmed { background: #fff; }

.badge { font-size: 10.5px; padding: 1px 6px; border-radius: 8px; white-space: nowrap; }
.badge.stale { background: #fff4d6; color: #8a6d1a; }
.badge.draft { background: #eceef2; color: #5a6472; }
.badge.confirmed { background: #e0f3e6; color: #237a3f; }

/* 根拠の鎖 */
.trace { border-left: 3px solid #fdeeec; padding-left: 14px; margin: 10px 0; }
.trace-step { margin-bottom: 10px; }
.trace-step .lbl { font-size: 11px; color: #c93d2e; font-family: ui-monospace, monospace; }
.trace-step .val { font-size: 13.5px; }
.trace-step .sub { font-size: 12px; color: #5a6472; }

/* カレンダー（月グリッド） */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-size: 11px; color: #8a92a0; text-align: center; padding: 4px 0; }
.cal-cell {
  min-height: 74px; border: 1px solid #e8ebf0; border-radius: 6px; padding: 4px 6px;
  background: #fff; font-size: 11px;
}
.cal-cell.other { background: #fafbfc; opacity: .5; }
.cal-cell .d { color: #8a92a0; font-family: ui-monospace, monospace; }
.cal-item {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 10.5px;
  border: none; border-radius: 4px; padding: 2px 4px; margin-top: 2px; cursor: pointer;
  background: #eceef2; color: #1c2433; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-item.empty { background: #f6f7f9; color: #8a92a0; }
.cal-item.planned { background: #fff4d6; }
.cal-item.drafted { background: #e3edfd; }
.cal-item.approved, .cal-item.posted { background: #e0f3e6; }

/* 制作スケジュール */
.week-head { font-size: 12px; color: #5a6472; margin: 16px 0 6px; font-weight: 700; }

/* モーダル */
.modal {
  display: none; position: fixed; inset: 0; background: rgba(28,36,51,.45);
  z-index: 50; padding: 24px; overflow-y: auto;
}
.modal.open { display: block; }
.modal-body {
  background: #fff; max-width: 720px; margin: 20px auto; border-radius: 10px;
  padding: 22px 24px; position: relative;
}
.modal-close {
  position: absolute; top: 10px; right: 12px; border: none; background: none;
  font-size: 22px; cursor: pointer; color: #8a92a0; line-height: 1;
}

/* 一括ルーティング */
.bulk-bar {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border: 1px solid #dde1e8; border-radius: 8px; padding: 10px 14px;
  margin-bottom: 12px; position: sticky; top: 56px; z-index: 3; font-size: 13px;
}
.ord-pick { margin-right: 8px; }
.ord-pick input { transform: scale(1.15); }

/* 月次プラン */
.month-section { margin-bottom: 22px; }
.month-theme {
  background: #fff; border: 1px solid #dde1e8; border-left: 4px solid #c93d2e;
  border-radius: 8px; padding: 14px 16px; margin-bottom: 10px;
}
.month-theme.stale { border-left-color: #e8a33d; background: #fffaf0; }
.month-theme h3 { font-size: 16px; margin: 6px 0 4px; }
.month-proposals { padding-left: 16px; }
.lane-kpi ul { margin: 4px 0 0; padding-left: 18px; }
button.linkish {
  border: none; background: none; color: #b23325; cursor: pointer;
  font-size: 12px; text-decoration: underline; padding: 0;
}
#attention:not(:empty) { max-width: 960px; margin: 16px auto -8px; padding: 0 20px; }
