/* ミーツメール 新UI試作 — 既存 css/app.css のトークンを複製 */
:root {
  --bg: #F4F5F2;
  --surface: #FFFFFF;
  --fg: #1F2421;
  --muted: #646B66;
  --line: #DDE1DC;
  --accent: #2F6F5E;
  --accent-dark: #255A4C;
  --accent-soft: #E3EFEA;
  --warn: #B4471F;
  --warn-soft: #FBEDE5;
  --ok: #2E7D4F;
  --ok-soft: #E3F2E8;
  --info: #2D5C8A;
  --info-soft: #E6EEF7;
  --pending-soft: #F1F0EA;
  --gray-soft: #ECEDEA;
  --radius: 10px;
  --font: "Hiragino Sans", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.35; margin: 0; }
h2 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pad-x { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ---------- 試作バナー ---------- */
.proto-banner { background: #FFF6D6; color: #6A5300; font-size: 13px; font-weight: 600; text-align: center; padding: 6px 16px;
  border-bottom: 1px solid #EBDDA6; padding-top: max(6px, env(safe-area-inset-top, 0px)); }

/* ---------- 文脈ヘッダー（戻る・イベント名・現在の作業） ---------- */
.ctx { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.ctx-in { max-width: 880px; margin: 0 auto; display: flex; align-items: center; gap: 8px; min-height: 60px; }
.ctx-back { flex: 0 0 auto; width: 44px; height: 44px; margin-left: -8px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; color: var(--fg); text-decoration: none; font-size: 22px; line-height: 1; }
.ctx-back:hover { background: var(--bg); }
.ctx-back[hidden] { display: inline-flex; visibility: hidden; }
.ctx-text { min-width: 0; flex: 1 1 auto; padding: 6px 0; }
.ctx-event { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-title { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: none; }
.ctx-home { flex: 0 0 auto; font-size: 13px; font-weight: 700; color: var(--accent); text-decoration: none; padding: 10px 8px; min-height: 44px; display: inline-flex; align-items: center; }
.ctx-home small { color: var(--muted); font-weight: 400; margin-left: 4px; }

/* ステップ表示 */
.steps { max-width: 880px; margin: 0 auto; display: flex; gap: 4px; list-style: none; padding-top: 0; padding-bottom: 10px; margin-block: 0; }
.steps li { flex: 1 1 0; min-width: 0; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted);
  border-top: 4px solid var(--line); padding-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps li.is-done { color: var(--accent); border-top-color: var(--accent-soft); }
.steps li.is-current { color: var(--accent); border-top-color: var(--accent); }

/* ---------- 本文 ---------- */
.main { max-width: 880px; margin: 0 auto; padding-top: 18px; padding-bottom: 80px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 22px 0 8px; }
.section-title:first-child { margin-top: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 > .card { margin-bottom: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ホームの大きな入口 */
.entry { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--fg); min-height: 120px; }
.entry:hover { border-color: var(--accent); }
.entry-title { font-size: 18px; font-weight: 700; }
.entry-num { font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1.2; margin-top: auto; }
.entry-num small { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 4px; }

/* ---------- ボタン ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font: inherit; font-weight: 700;
  text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.actions .btn-primary { min-width: 160px; }
.actions .btn-left { margin-right: auto; }

/* ---------- チップ ---------- */
.chip { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.8; white-space: nowrap; background: var(--pending-soft); color: var(--muted); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-gray { background: var(--gray-soft); color: #5C625E; }
.chip-strong { background: var(--accent); color: #fff; }
.chip-line { background: transparent; border: 1px solid var(--line); }

/* ---------- 進捗集計 ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 2px 0 10px; }
.stat { font-size: 13px; color: var(--muted); }
.stat b { font-size: 20px; color: var(--fg); margin-left: 4px; }
.bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--gray-soft); margin-bottom: 12px; }
.bar span { display: block; height: 100%; }
.bar .s-ok { background: var(--ok); }
.bar .s-maybe { background: #C9A227; }
.bar .s-ng { background: #A9AFAA; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin: -6px 0 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }

/* 作業ボタン一覧 */
.tasks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.task { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 4px; border-bottom: 1px solid var(--line);
  color: var(--fg); text-decoration: none; }
.tasks li:last-child .task { border-bottom: 0; }
.task:hover { background: #FAFBF9; }
.task-no { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--gray-soft); color: var(--muted);
  font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.task-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.task-label { font-weight: 700; }
.task-note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.task-go { color: var(--muted); }
.task.is-next { background: var(--accent-soft); border-radius: 8px; border-bottom-color: transparent; }
.task.is-next .task-no { background: var(--accent); color: #fff; }
.task.is-next .task-label::after { content: "次はこれ"; margin-left: 8px; font-size: 11px; color: #fff; background: var(--accent);
  border-radius: 999px; padding: 1px 8px; vertical-align: 2px; }

/* ---------- リスト ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); min-height: 56px; }
.list > li:last-child .row, .list > li:last-child.row { border-bottom: 0; }
a.row { color: var(--fg); text-decoration: none; }
a.row:hover { background: #FAFBF9; }
.row-main { flex: 1 1 auto; min-width: 0; }
.row-title { display: block; font-weight: 700; }
.row-sub { display: block; font-size: 12px; color: var(--muted); }
.row-side { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-comment { font-size: 13px; margin-top: 2px; }
label.row { cursor: pointer; }
label.row.is-disabled { cursor: default; opacity: .6; }
.check { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--accent); margin: 0; }
.list-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }

/* フィルタタブ */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.tab { font: inherit; font-size: 13px; font-weight: 700; min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer; }
.tab.is-active { background: var(--fg); color: #fff; border-color: var(--fg); }
.tab b { margin-left: 4px; }

/* ---------- フォーム ---------- */
.field { display: block; margin-bottom: 7px; min-width: 0; }
.field > span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.input, .select, .textarea { display: block; width: 100%; min-width: 0; max-width: 100%; font: inherit; font-size: 16px; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 44px; }
.textarea { min-height: 220px; line-height: 1.7; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.search { margin-bottom: 10px; }
.radios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 7px; }
.radio { position: relative; }
.radio input { position: absolute; opacity: 0; inset: 0; }
.radio span { display: flex; align-items: center; justify-content: center; min-height: 52px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); font-weight: 700; cursor: pointer; }
.radio input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.radio input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- メールの確認・結果 ---------- */
.kv { display: grid; grid-template-columns: 7em 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 600; min-width: 0; }
.preview { white-space: pre-wrap; background: #FAFBF9; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 14px; margin-top: 8px; }
.result-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.result-sum div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; font-size: 12px; color: var(--muted); }
.result-sum b { display: block; font-size: 24px; color: var(--fg); }
.result-sum .is-bad b { color: var(--warn); }
.note { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 12px; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.note-info { background: var(--info-soft); color: var(--info); }

/* ---------- トースト ---------- */
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50;
  background: var(--fg); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 700; max-width: calc(100% - 32px);
  box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); }
.foot { max-width: 880px; margin: 0 auto; padding-bottom: 32px; text-align: center; }
.linkbtn { font: inherit; font-size: 12px; color: var(--muted); background: none; border: 0; text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 8px; }

/* ---------- スマホ ---------- */
@media (max-width: 640px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .entry { min-height: 0; }
  .ctx-home small { display: none; }
  .row { flex-wrap: wrap; }
  .row-side { justify-content: flex-start; }
  label.row, a.row { flex-wrap: nowrap; }
  .actions { flex-direction: column-reverse; }
  .actions .btn { width: 100%; }
  .actions .btn-left { margin-right: 0; }
  .kv { grid-template-columns: 5.5em 1fr; }
  input[type="datetime-local"], input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; }
}

/* ---------- イベント一覧の見出し行・新規作成フォーム ---------- */
.list-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.list-head .tabs { flex: 1 1 auto; min-width: 0; }
.list-head > .btn { flex: none; margin-bottom: 12px; }
.field > span em.chip { font-style: normal; margin-left: 4px; font-size: 11px; line-height: 1.6; vertical-align: 1px; }
.field-hint { display: block; margin-top: 2px; }
.field-err { display: block; margin-top: 2px; font-size: 13px; font-weight: 700; color: var(--warn); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--warn); }
.textarea-sm { min-height: 96px; }
@media (max-width: 640px) {
  input.input[type="datetime-local"], input.input[type="date"], input.input[type="time"] { -webkit-appearance: none; appearance: none; text-align: left; }
}
/* フォーム内：縦の間隔は .field の余白にそろえ、必須／任意などの区切りは少し広めに残す */
form .grid2 { row-gap: 0; }
form .section-title { margin: 14px 0 4px; }
