/* sns-autopost 管理画面（初心者にもわかりやすいUI） */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  color-scheme: light; /* 端末のダークモードによる自動反転を防ぐ */
  --navy: #0e1b2d;
  --navy2: #16304e;
  --blue: #2f7fe0;
  --blue-light: #eaf2fd;
  --teal: #35c3a9;
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #5f7186;
  --line: #dfe6ee;
  --danger: #d64545;
  --amber-bg: #fff7e6;
  --amber-line: #f0d9a8;
  --radius: 14px;
}
body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
}

/* ---------- header ---------- */
.l-header {
  background: var(--navy);
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.l-header__brand { font-weight: 700; font-size: 16px; letter-spacing: .05em; white-space: nowrap; }
.l-header__brand small { font-weight: 400; opacity: .6; margin-left: 8px; font-size: 11px; }
.l-header__nav { display: flex; gap: 2px; }
.l-header__nav a {
  color: rgba(255,255,255,.78);
  text-decoration: none;
  padding: 8px 15px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
}
.l-header__nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.l-header__nav a.is-active { background: var(--blue); color: #fff; font-weight: 600; }
.l-header__account { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.l-header__account .acc-label { font-size: 12px; opacity: .7; white-space: nowrap; }
.l-header__account select {
  background: var(--navy2);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  max-width: 180px;
}
.l-header__logout {
  background: transparent;
  color: rgba(255,255,255,.75);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.l-header__logout:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ---------- layout ---------- */
.l-main { max-width: 1080px; margin: 0 auto; padding: 28px 24px 100px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.page-lead { color: var(--muted); font-size: 14px; margin-bottom: 22px; }

/* ---------- banners ---------- */
.banner {
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
  font-size: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.banner__icon { font-size: 20px; line-height: 1.4; }
.banner--test { background: var(--amber-bg); border: 1px solid var(--amber-line); }
.banner--live { background: #e5f6f0; border: 1px solid #bfe5d8; }
.banner strong { font-weight: 700; }

/* ---------- step flow ---------- */
.steps { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0; margin-bottom: 24px; }
.step {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 18px 20px 16px;
  position: relative;
  text-align: center;
}
.step:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.step:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.step + .step { border-left: none; }
.step__num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue); color: #fff; font-weight: 700; font-size: 15px;
  margin-bottom: 8px;
}
.step__title { font-weight: 700; font-size: 15px; }
.step__desc { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.step__arrow {
  position: absolute; right: -11px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; background: var(--blue); color: #fff;
  border-radius: 50%; font-size: 13px; line-height: 22px; text-align: center; z-index: 2;
}

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.card h2 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.card .help { color: var(--muted); font-size: 13px; margin-bottom: 16px; line-height: 1.7; }
.grid { display: grid; gap: 16px; }
.grid--stats { grid-template-columns: repeat(4, 1fr); }
.grid--2 { grid-template-columns: 1fr 1fr; }

.stat { text-align: center; padding: 16px 0 14px; }
.stat__num { font-size: 32px; font-weight: 700; color: var(--navy); line-height: 1.2; }
.stat__label { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
  font-family: inherit;
}
.btn:hover { opacity: .88; }
.btn--xl { padding: 16px 34px; font-size: 16px; }
.btn--ghost { background: #fff; color: var(--text); border: 1.5px solid var(--line); font-weight: 600; }
.btn--danger { background: #fff; color: var(--danger); border: 1.5px solid var(--danger); font-weight: 600; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- draft cards ---------- */
.draft {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.draft__imgwrap { text-align: center; }
.draft__img { width: 320px; height: 320px; object-fit: cover; border-radius: 12px; background: #dde3ea; }
.draft__noimg {
  width: 320px; height: 320px; border-radius: 12px; background: #eef1f5;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  font-size: 13px; text-align: center; padding: 20px;
}
.draft__imgnote { font-size: 11px; color: var(--muted); margin-top: 6px; }
.draft__thumbs { display: flex; gap: 6px; margin-top: 8px; justify-content: center; flex-wrap: wrap; }
.draft__thumb {
  width: 54px; height: 54px; object-fit: cover; border-radius: 8px;
  border: 2px solid transparent; cursor: pointer; opacity: .65;
}
.draft__thumb:hover { opacity: 1; }
.draft__thumb.is-active { border-color: var(--blue); opacity: 1; }
.draft__meta { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.draft__title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.draft__caplabel { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.draft__caption {
  width: 100%; min-height: 190px; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-family: inherit; font-size: 14px; line-height: 1.8; resize: vertical;
}
.draft__caption:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.draft__actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.draft__error { color: var(--danger); font-size: 13px; margin-top: 10px; }

.tag {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: #e8f0fb; color: var(--blue);
}
.tag--gray { background: #eef1f5; color: var(--muted); }
.tag--green { background: #e2f6f0; color: #14805f; }
.tag--red { background: #fbe8e8; color: var(--danger); }
.tag--amber { background: #fdf3e0; color: #9a6b0c; }

/* ---------- table ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
tr:hover td { background: #f8fafc; }

/* ---------- forms ---------- */
.form-row { display: grid; grid-template-columns: 190px 1fr; gap: 14px; align-items: start; margin-bottom: 14px; }
.form-row label { font-size: 14px; color: var(--text); font-weight: 600; padding-top: 8px; }
.form-row input, .form-row select, .form-row textarea {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 13px;
  font-family: inherit; font-size: 14px; width: 100%;
}
.form-row textarea { min-height: 68px; resize: vertical; }
.form-note { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.6; }

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.inline-form input, .inline-form select, .inline-form textarea {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 13px;
  font-family: inherit; font-size: 14px;
}
.inline-form textarea { flex: 1; min-width: 300px; }

.field { margin-bottom: 4px; }
.field__label { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.field__note { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- section divider ---------- */
.section-title { font-size: 18px; font-weight: 700; margin: 28px 0 4px; }
.section-lead { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* ---------- guide ---------- */
.guide-block { margin-bottom: 10px; }
.guide-block h3 { font-size: 16px; font-weight: 700; margin: 18px 0 6px; }
.guide-block p, .guide-block li { font-size: 14px; color: var(--text); }
.guide-block ol, .guide-block ul { padding-left: 22px; margin: 6px 0; }
.guide-q { font-weight: 700; margin-top: 14px; }
.guide-a { color: var(--muted); font-size: 14px; }

/* ---------- misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 44px 16px; font-size: 14px; line-height: 1.8; }
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--navy); color: #fff;
  padding: 14px 22px; border-radius: 12px; font-size: 14px; z-index: 200;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); display: none; max-width: 440px; line-height: 1.6;
}
.spinner {
  display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite;
  vertical-align: -2px; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); font-size: 13px; }

/* 入力幅ユーティリティ（レスポンシブで上書きされる） */
.w-sm { width: 200px; }
.w-grow { flex: 1; min-width: 240px; }

/* ---------- レスポンシブ：タブレット（〜1100px） ---------- */
@media (max-width: 1100px) {
  .l-main { max-width: 100%; padding: 24px 20px 90px; }

  /* ヘッダー：2段組＋ナビ横スクロール（ログアウト・アカウント切替と共存させる） */
  .l-header { flex-wrap: wrap; height: auto; padding: 10px 16px 8px; gap: 8px 12px; }
  .l-header__brand small { display: none; }
  .l-header__account { gap: 6px; }
  .l-header__account .acc-label { display: none; }
  .l-header__nav {
    order: 3; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .l-header__nav a { white-space: nowrap; }
}

@media (max-width: 1024px) {
  .grid--2 { grid-template-columns: 1fr; }
  .draft { grid-template-columns: 260px 1fr; gap: 18px; }
  .draft__img, .draft__noimg { width: 260px; height: 260px; }
}

/* ---------- レスポンシブ：スマホ（〜800px） ---------- */
@media (max-width: 800px) {
  body { font-size: 14px; }
  .l-main { padding: 18px 14px 80px; }
  .page-title { font-size: 20px; }

  .l-header__brand { font-size: 14px; }
  .l-header__account select { max-width: 140px; padding: 6px 8px; font-size: 13px; }
  .l-header__nav a { font-size: 13px; padding: 6px 11px; }

  /* 3ステップ：縦積み（番号を左に） */
  .steps { grid-template-columns: 1fr; }
  .step {
    display: grid; grid-template-columns: 34px 1fr; column-gap: 12px;
    text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-top: none;
  }
  .step:first-child { border-radius: var(--radius) var(--radius) 0 0; border-top: 1px solid var(--line); }
  .step:last-child { border-radius: 0 0 var(--radius) var(--radius); }
  .step + .step { border-left: 1px solid var(--line); }
  .step__num { grid-row: 1 / span 2; margin-bottom: 0; }
  .step__arrow { display: none; }

  /* 統計は2×2 */
  .grid--stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat__num { font-size: 26px; }

  /* カード・フォーム */
  .card { padding: 16px 16px; }
  .form-row { grid-template-columns: 1fr; gap: 4px; margin-bottom: 16px; }
  .form-row label { padding-top: 0; }
  .inline-form { gap: 8px; }
  .inline-form input:not([type="color"]), .inline-form select,
  .inline-form textarea, .inline-form button,
  .w-sm, .w-grow { width: 100%; flex: 1 1 100%; min-width: 0; }
  .btn--xl { width: 100%; }

  /* 下書きカード：縦積み・画像は幅いっぱい */
  .draft { grid-template-columns: 1fr; gap: 14px; padding: 14px; }
  .draft__imgwrap { margin: 0 auto; width: 100%; max-width: 420px; }
  .draft__img, .draft__noimg { width: 100%; max-width: 420px; height: auto; aspect-ratio: 1 / 1; }
  .draft__actions { gap: 8px; }
  .draft__actions .btn { flex: 1 1 45%; padding: 11px 8px; font-size: 13px; }

  /* テーブルは横スクロール */
  .card { overflow-x: auto; }
  .card table { min-width: 560px; }
  th, td { padding: 9px 8px; font-size: 12.5px; }

  .toast { left: 14px; right: 14px; bottom: 14px; max-width: none; }
}
