/* 2本の PWA で共通の見た目。色の --accent は各アプリで決める。 */
:root {
  --bg: #f6f3ee; --card: #ffffff; --ink: #1f2328; --sub: #5f6670; --line: #e3ded6;
  --red: #c8322b; --red-bg: #fdecea; --yellow: #a86a00; --yellow-bg: #fff4d6; --green: #2f7d4f; --green-bg: #e8f5ec;
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
header.top {
  position: sticky; top: 0; z-index: 5; background: var(--accent); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 10px calc(16px + env(safe-area-inset-left)); display: flex; align-items: center; gap: 10px;
}
header.top h1 { font-size: 19px; margin: 0; flex: 1; letter-spacing: .02em; }
header.top button { background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 10px; padding: 8px 12px; font-size: 14px; }
main { max-width: 640px; margin: 0 auto; padding: 14px calc(14px + env(safe-area-inset-right)) 0 calc(14px + env(safe-area-inset-left)); }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.summary div { background: var(--card); border-radius: var(--radius); padding: 10px; text-align: center; border: 1px solid var(--line); }
.summary b { display: block; font-size: 22px; line-height: 1.2; }
.summary span { font-size: 12px; color: var(--sub); }
.summary .bad b { color: var(--red); } .summary .warn b { color: var(--yellow); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.card.bad { border-left: 6px solid var(--red); } .card.warn { border-left: 6px solid #e0a000; } .card.ok { border-left: 6px solid var(--green); } .card.done { opacity: .65; }
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.title { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.meta { color: var(--sub); font-size: 13px; }
.pill { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.pill.bad { background: var(--red-bg); color: var(--red); } .pill.warn { background: var(--yellow-bg); color: var(--yellow); } .pill.ok { background: var(--green-bg); color: var(--green); }
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--line); flex: none; }
button, .btn { font: inherit; cursor: pointer; }
.btn { border: 0; border-radius: 12px; padding: 11px 14px; background: var(--accent); color: #fff; font-weight: 700; min-height: 44px; }
.btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn.plain { background: #eceae5; color: var(--ink); }
.btn.danger { background: transparent; color: var(--red); border: 1.5px solid var(--red); }
.btn.small { padding: 7px 12px; min-height: 36px; font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.fab {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 6;
  border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-size: 17px; font-weight: 700;
  padding: 14px 22px; box-shadow: 0 6px 18px rgba(0,0,0,.22);
}
.empty { text-align: center; color: var(--sub); padding: 30px 10px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; }
.tabs button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-size: 14px; white-space: nowrap; }
.tabs button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
/* 入力の画面 */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 20px)); max-height: calc(100dvh - 30px); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog .dhead { position: sticky; top: 0; background: #fff; padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
dialog .dhead h2 { margin: 0; font-size: 18px; flex: 1; }
dialog .dbody { padding: 14px 16px; }
dialog .dfoot { position: sticky; bottom: 0; background: #fff; padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
label.f { display: block; margin-bottom: 12px; font-size: 14px; color: var(--sub); }
label.f > input, label.f > select, label.f > textarea, .inline input, .inline select {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 16px; color: var(--ink);
  padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
}
label.f > textarea { min-height: 80px; resize: vertical; }
.inline { display: flex; gap: 8px; } .inline > * { flex: 1; }
.hist { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; }
.hist li { border-top: 1px dashed var(--line); padding: 6px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chips button { border: 1px solid var(--line); background: #faf8f4; border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.note { font-size: 13px; color: var(--sub); }
footer.foot { text-align: center; font-size: 12px; color: var(--sub); padding: 24px 10px 10px; }
footer.foot a { color: var(--sub); }
#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .25s; pointer-events: none; z-index: 20; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.install { background: #fff8e6; border: 1px solid #f0d58a; border-radius: var(--radius); padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
