/* popup.css — ウィザード形式 / モバイルファースト / 白背景 / 大ボタン / 最小14px */
:root {
  --green: #00532f;
  --green-mid: #318c46;
  --line: #e3e6e3;
  --ink: #1a1a1a;
  --muted: #6b716c;
  --bg-soft: #f6f8f6;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 360px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
}
body { padding: 14px 16px 18px; min-height: 480px; }

/* Web版（拡張機能のポップアップではなく通常のブラウザタブ）ではノートPC幅を活かした
   中央寄せカードレイアウトにする（popup.jsがStore.isExtensionEnvを見てbodyに付与するクラス）。
   拡張機能のポップアップウィンドウ自体は360px固定のままにする（変えると小さすぎ/大きすぎになるため）。 */
html:has(body.web-mode), html.web-mode { width: auto; }
body.web-mode {
  width: auto;
  min-width: 0;
  min-height: 100vh;
  background: var(--bg-soft);
  padding: 0;
}
body.web-mode .view {
  max-width: 560px;
  margin: 0 auto;
  background: #fff;
  padding: 32px 40px 40px;
  min-height: 100vh;
  box-sizing: border-box;
}
@media (min-width: 700px) {
  body.web-mode .view { min-height: auto; margin-top: 40px; margin-bottom: 40px; border-radius: 16px; box-shadow: 0 1px 3px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06); border: 1px solid var(--line); }
}

.view { animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.hidden { display: none !important; }

/* ---- 初回設定 ---- */
.setup-title { font-size: 18px; color: var(--green); margin: 6px 0 10px; }
.setup-lead { font-size: 13px; color: var(--muted); line-height: 1.7; margin: 0 0 16px; }
#setup-name {
  width: 100%; font-size: 16px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px;
}
#setup-name:focus { outline: none; border-color: var(--green-mid); }

/* ---- ウィザードヘッダー ---- */
.wiz-header { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.icon-btn {
  width: 34px; height: 34px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 50%;
  background: #fff; color: var(--ink); font-size: 16px; cursor: pointer;
}
.icon-btn:hover { border-color: var(--green-mid); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.progress { flex: 1; height: 6px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
#progress-fill { height: 100%; width: 0; background: var(--green); border-radius: 999px; transition: width .25s ease; }
.rep-badge {
  flex: 0 0 auto; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; color: var(--green); background: var(--bg-soft);
  border: none; border-radius: 999px; padding: 6px 10px; cursor: pointer;
}

/* ---- ステップ ---- */
.step-num { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.step-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; color: var(--ink); }
.step-sub { font-size: 12px; color: var(--muted); margin: 0 0 16px; }
.list-heading { font-size: 12px; font-weight: 700; color: var(--ink); margin: 4px 0 6px; }
.step-body { margin-bottom: 4px; }

/* 選択肢ボタン群 */
.choices { display: grid; gap: 10px; }
.choices.cols-1 { grid-template-columns: 1fr; }
.choices.cols-2 { grid-template-columns: 1fr 1fr; }
.choices.cols-5 { grid-template-columns: repeat(5, 1fr); }
.choice {
  font-size: 16px; font-weight: 600;
  padding: 16px 10px;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink); cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, transform .06s;
}
.cols-5 .choice, .cols-2 .choice { padding: 16px 6px; }
.choice:hover { border-color: var(--green-mid); }
.choice:active { transform: scale(.97); }
.choice.selected { background: var(--green); border-color: var(--green); color: #fff; }

/* テキスト/日付入力ステップ */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field > span em { font-style: normal; color: #aab0ab; font-size: 11px; }
.field input, .field select, .field textarea {
  width: 100%; box-sizing: border-box; font-size: 16px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); font-family: inherit;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--green-mid); }

/* 任意項目の折りたたみ */
.optional { margin-top: 4px; }
.optional > summary {
  cursor: pointer; font-size: 12px; color: var(--green-mid); list-style: none; padding: 6px 0;
}
.optional > summary::-webkit-details-marker { display: none; }
.optional > summary::before { content: "＋ "; }
.optional[open] > summary::before { content: "− "; }

/* 小型ボタングループ（会社ステップ内の従業員ランク等） */
.mini-group { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.mini-opt {
  font-size: 13px; padding: 10px 4px; text-align: center;
  border: 1.5px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer;
}
.mini-opt:hover { border-color: var(--green-mid); }
.mini-opt.selected { background: var(--green); border-color: var(--green); color: #fff; }

/* 進む/保存ボタン */
.primary {
  width: 100%; font-size: 16px; font-weight: 700; padding: 14px;
  border: none; border-radius: var(--radius); background: var(--green); color: #fff; cursor: pointer;
  margin-top: 14px;
}
.primary:hover { background: var(--green-mid); }
.primary.ghost { background: #fff; color: var(--green); border: 1px solid var(--green); margin-top: 10px; }
.primary.danger { background: #8B2332; }
.primary.danger:hover { background: #6f1c28; }
.skip-link { display: block; text-align: center; font-size: 12px; color: var(--muted); margin-top: 12px; cursor: pointer; background: none; border: none; width: 100%; }

/* ---- 案件選択（フォロー）---- */
.deal-search { width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.deal-search:focus { outline: none; border-color: var(--green-mid); }
.deal-list { display: grid; gap: 8px; max-height: 320px; overflow-y: auto; }
.deal-item { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.deal-item:hover { border-color: var(--green-mid); }
.deal-item.selected { background: var(--green); border-color: var(--green); color: #fff; }
.deal-name { font-size: 14px; font-weight: 600; }
.deal-sub { font-size: 11px; color: var(--muted); }
.deal-item.selected .deal-sub { color: rgba(255,255,255,.85); }

/* ---- 完了画面 ---- */
.done { text-align: center; padding: 24px 8px; }
.done .check {
  width: 56px; height: 56px; line-height: 56px; margin: 0 auto 14px;
  border-radius: 50%; background: var(--green); color: #fff; font-size: 30px;
}
.done h2 { margin: 0 0 18px; font-size: 18px; }
.score-label { font-size: 12px; color: var(--muted); margin: 0 0 2px; }
.score { font-size: 46px; font-weight: 800; color: var(--green); line-height: 1; }
.score::after { content: "%"; font-size: 20px; font-weight: 600; }
.score-bar { width: 100%; height: 8px; background: var(--bg-soft); border-radius: 999px; margin: 14px 0 4px; overflow: hidden; }
.score-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--green-mid), var(--green)); transition: width .5s ease; }

.error-text { color: #c0392b; font-size: 12px; margin: 8px 0 0; text-align: center; }
.req { font-style: normal; color: #c0392b; font-size: 11px; background: #fbecea; border-radius: 4px; padding: 1px 5px; }
.invalid { border-color: #c0392b !important; }
.invalid-group { outline: 1.5px solid #c0392b; outline-offset: 2px; border-radius: 8px; }
.title-hint { font-size: 11px; color: var(--muted); background: var(--bg-soft); border-radius: 6px; padding: 6px 8px; margin: -4px 0 10px; line-height: 1.6; }
