/* NM Prep Checklist - Mobile-first UI */

/* Base */
.nm-prep { padding: 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", Roboto, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif; }
.nm-prep h2 { margin: 0 0 12px; font-size: 20px; line-height: 1.4; }
.nm-prep h3 { margin: 18px 0 8px; font-size: 16px; }
.nm-prep .nm-footnote { margin-top: 12px; font-size: 12px; color: #888; }

/* 進捗バー：画面上部に固定 */
.nm-prep { padding: 16px; padding-top: 64px; }
.nm-prep .nm-progress{
  position: fixed;
  left: 0;
  right: 0;
  top: 0; /* ← ヘッダーの高さに合わせて調整 */
  background: #fff;
  z-index: 999;
  padding: 10px 16px 12px;
  border-bottom: 1px solid #eee;
}
.nm-prep .nm-progress .bar{ display:block; height:6px; background:#eee; border-radius:4px; position:relative; overflow:hidden; }
.nm-prep .nm-progress .bar::after{ content:''; position:absolute; left:0; top:0; bottom:0; width:var(--pct,0%); background:#1e88e5; }
.nm-prep .nm-progress .pct{ font-size:12px; color:#666; margin-left:6px; }

/* List */
.nm-prep .nm-list { list-style: none; margin: 0; padding: 0; }
.nm-prep .nm-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "label  check"
    "meta   check"
    "note   del";
  gap: 6px 12px;
  padding: 14px 12px;
  border-bottom: 1px solid #eee;
  background: #fff;
}
/* ラベル行にカテゴリバッジを先頭表示 */
.nm-prep .label { grid-area: label; font-size: 16px; line-height: 1.5; }
.nm-prep .badge-cat{
  display:inline-block; margin-right:8px; font-size:12px; line-height:1;
  padding:6px 8px; background:#f5f5f5; color:#555; border-radius:999px; border:1px solid #e5e5e5;
}

/* due/hint 表示 */
.nm-prep .meta { grid-area: meta; display:flex; flex-wrap: wrap; gap:6px 8px; align-items: center; }
.nm-prep .badge-due {
  display:inline-block; font-size:12px; line-height:1; padding:6px 8px;
  background:#eef5ff; color:#1e88e5; border-radius:999px; border:1px solid #d8e7ff;
}
.nm-prep .hint { font-size:12px; color:#666; }
.nm-prep .hint a{ text-decoration: underline; }

.nm-prep .check { grid-area: check; display:flex; align-items:center; justify-content:center; }
.nm-prep .check input[type="checkbox"]{ width: 22px; height: 22px; }
.nm-prep .note { grid-area: note; }
.nm-prep .note input{
  width: 100%; height: 40px; padding: 8px 10px;
  border:1px solid #ddd; border-radius:8px; font-size:14px;
}
.nm-prep .del { grid-area: del; text-align: right; }
.nm-prep .nm-del{
  background:#f44336; color:#fff; border:none; border-radius:8px;
  padding:8px 12px; font-size:13px; cursor:pointer;
}

/* Add form */
.nm-prep .nm-addform { margin-top:16px; padding:12px; border:1px dashed #ddd; border-radius:12px; background:#fafafa; }
.nm-prep .nm-addform input{
  width:100%; margin:6px 0; height:40px; padding:8px 10px; border:1px solid #ddd; border-radius:8px; font-size:14px;
}
.nm-prep .nm-addform button{
  width:100%; height:42px; border:none; border-radius:10px; font-size:15px; background:#1e88e5; color:#fff; cursor:pointer;
}

/* Desktop layout */
@media (min-width: 768px){
  .nm-prep .nm-row{
    grid-template-columns: 160px 1fr 120px 60px 1fr 80px;
    grid-template-areas: "cat label due check note del";
    align-items: center;
  }
  .nm-prep .label { font-size: 15px; }
  .nm-prep .due{ text-align:center; }
}

/* Subtle focus states */
.nm-prep input[type="text"]:focus{ outline: none; border-color:#1e88e5; box-shadow: 0 0 0 3px rgba(30,136,229,.12); }
.nm-prep .nm-addform button:active, .nm-prep .nm-del:active { transform: translateY(1px); }

@media (min-width: 768px){
  .nm-prep .meta{ justify-content: flex-start; }
}

/* 全クリアボタン */
.nm-prep .nm-clearall{
  width:100%; height:42px; border:none; border-radius:10px;
  font-size:15px; background:#9e9e9e; color:#fff; cursor:pointer;
  margin-top:8px;
}
.nm-prep .nm-clearall:active{ transform: translateY(1px); }

/* ==== PC崩れ修正：実際の要素に合わせて5カラムに再定義 ==== */
@media (min-width: 768px){
  .nm-prep { max-width: 1200px; margin: 0 auto; } /* 画面中央に収める（任意） */

  .nm-prep .nm-row{
    /* 実在するエリア: label | meta | check | note | del */
    grid-template-columns: 2fr 2fr 64px 2fr 84px;
    grid-template-areas: "label meta check note del";
    align-items: center;
    column-gap: 16px;
  }

  /* 微調整 */
  .nm-prep .label { font-size: 15px; }
  .nm-prep .meta { justify-content:flex-start; }
  .nm-prep .check { justify-content:center; }
  .nm-prep .del   { text-align:right; }
  .nm-prep .nm-del{ min-width:72px; }  /* ボタン幅のブレ防止 */

  /* 進捗バーの下に少し余白（テーマのヘッダーが高い場合の被り回避） */
  .nm-prep { padding-top: 76px; } /* 必要に応じて 64→76→88 と調整 */
}

/* バッジ/リンクの折返しが窮屈な場合は行間を少し広げる */
.nm-prep .meta { row-gap: 12px; }

/* ==== PC崩れ修正：実在する5エリアに合わせる ==== */
@media (min-width: 768px){
  .nm-prep { max-width: 960px; margin: 0 auto; padding-top: 76px; }
  .nm-prep .nm-row{
    grid-template-columns: 2fr 2fr 64px 2fr 84px;
    grid-template-areas: "label meta check note del";
    align-items: center;
    column-gap: 16px;
  }
  .nm-prep .meta{ justify-content:flex-start; }
  .nm-prep .nm-del{ min-width:72px; }
}