/* ふたりの台所 — one-column phone app: sticky header, bottom tab bar, sheets for detail and forms */
:root {
  --bg: #F1F4F0; --surface: #FFFFFF; --ink: #1D2621; --muted: #637069; --line: #DCE2DB;
  --accent: #2E6A53; --accent-ink: #FFFFFF; --soft: #E4EDE6;
  --pending: #9A6514; --pending-bg: #FBF0DA;
  --accepted: #255F9E; --accepted-bg: #E2ECF8;
  --done: #2B714A; --done-bg: #DFF1E5;
  --declined: #6E7470; --declined-bg: #EBEDEB;
  --danger: #B03A2E;
  --shadow: 0 1px 2px rgba(20,40,30,.06), 0 6px 18px rgba(20,40,30,.06);
  --f-display: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  --f-body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #131816; --surface: #1B221F; --ink: #E6ECE7; --muted: #9AA69F; --line: #2B3430;
  --accent: #7FC4A4; --accent-ink: #0E1512; --soft: #22302A;
  --pending: #E9B65E; --pending-bg: #382C16; --accepted: #8DBAEC; --accepted-bg: #1C2B3C;
  --done: #82D3A3; --done-bg: #18321F; --declined: #A6ACA8; --declined-bg: #282D2B; --danger: #F08A7E;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #131816; --surface: #1B221F; --ink: #E6ECE7; --muted: #9AA69F; --line: #2B3430;
  --accent: #7FC4A4; --accent-ink: #0E1512; --soft: #22302A;
  --pending: #E9B65E; --pending-bg: #382C16; --accepted: #8DBAEC; --accepted-bg: #1C2B3C;
  --done: #82D3A3; --done-bg: #18321F; --declined: #A6ACA8; --declined-bg: #282D2B; --danger: #F08A7E;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }
body { padding-top: env(safe-area-inset-top, 0px); -webkit-tap-highlight-color: transparent; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.6; }
.wrap { max-width: 560px; margin: 0 auto; padding-inline: 16px; padding-block: 0 calc(150px + env(safe-area-inset-bottom, 0px)); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px 10px; }
.brand { font-family: var(--f-display); font-weight: 700; font-size: 1.3rem; letter-spacing: .04em; margin: 0; }
.brand small { display: block; font-family: var(--f-body); font-weight: 400; font-size: .72rem; color: var(--muted); letter-spacing: .08em; }
.members { display: flex; align-items: center; }
.av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-family: var(--f-display); font-weight: 700; font-size: .9rem; border: 2px solid var(--bg); background: var(--c, var(--muted)); flex: none; }
.members .av + .av { margin-left: -8px; }
.members button.av { padding: 0; }
.av.sm { width: 22px; height: 22px; font-size: .68rem; border-width: 0; }

.notice { background: var(--soft); border-radius: 12px; padding: 12px 14px; font-size: .88rem; margin-block: 4px 12px; }
.notice strong { font-family: var(--f-display); }

.onboard { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; margin-block: 4px 16px; display: grid; gap: 12px; }
.onboard h2, .sheet h2 { font-family: var(--f-display); font-size: 1.1rem; margin: 0; text-wrap: balance; }

h2.sec { font-family: var(--f-display); font-size: .95rem; font-weight: 700; margin: 22px 0 10px; display: flex; align-items: baseline; gap: 8px; }
h2.sec .n { font-family: var(--f-body); color: var(--muted); font-weight: 500; font-size: .8rem; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-size: .88rem; padding: 14px; border: 1px dashed var(--line); border-radius: 12px; }

.list { display: grid; gap: 10px; }
.req { background: var(--surface); border-radius: 14px; padding: 12px 14px 12px 16px; box-shadow: var(--shadow); position: relative; display: grid; gap: 4px; }
.req::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c, var(--muted)); }
.req-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.req-top time { margin-left: auto; font-variant-numeric: tabular-nums; }
.req h3 { font-family: var(--f-display); font-size: 1.08rem; margin: 2px 0 0; }
.route { font-size: .82rem; color: var(--muted); margin: 0; display: flex; align-items: center; gap: 6px; }
.msg { margin: 4px 0 0; padding: 8px 10px; background: var(--soft); border-radius: 10px; font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.reply { background: transparent; border: 1px solid var(--line); }
.msg .who { display: block; font-size: .72rem; color: var(--muted); }

.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 1px 9px; font-size: .74rem; font-weight: 700; letter-spacing: .03em; }
.st-pending { color: var(--pending); background: var(--pending-bg); }
.st-accepted { color: var(--accepted); background: var(--accepted-bg); }
.st-done { color: var(--done); background: var(--done-bg); }
.st-declined { color: var(--declined); background: var(--declined-bg); }
.when { border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-weight: 500; font-size: .88rem; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }

.toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-block: 6px 14px; }
.row-between > .chips { min-width: 0; flex: 1; }
.search { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 9px 12px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: .84rem; display: inline-flex; align-items: center; gap: 6px; }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.dishes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-items: start; }
.dish { text-align: left; background: var(--surface); border: 0; border-radius: 14px; box-shadow: var(--shadow); padding: 12px; display: grid; gap: 6px; align-content: start; border-top: 4px solid var(--c, var(--muted)); min-width: 0; }
.dish .nm { font-family: var(--f-display); font-weight: 700; font-size: 1rem; line-height: 1.35; overflow-wrap: anywhere; }
.dish .meta { font-size: .76rem; color: var(--muted); }
.dish .by { font-size: .78rem; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.dish .tag { font-size: .72rem; font-weight: 700; color: var(--pending); }
.dish .ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--soft); display: block; }
.req-main { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.req-main > div { min-width: 0; }
.req .th { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; }
.photo-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.photo-prev { width: 96px; height: 72px; border-radius: 10px; background: var(--bg); border: 1px dashed var(--line); display: grid; place-items: center; font-size: .74rem; color: var(--muted); overflow: hidden; flex: none; }
.photo-prev img { width: 100%; height: 100%; object-fit: cover; }
.detail-ph { width: 100%; max-height: 52vh; object-fit: cover; border-radius: 12px; background: var(--soft); display: block; }
.sr { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 16px calc(6px + env(safe-area-inset-bottom, 0px)); }
nav.tabs .in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; gap: 6px; }
.tab { background: none; border: 0; padding: 8px; border-radius: 10px; font-weight: 700; font-size: .86rem; color: var(--muted); display: inline-flex; justify-content: center; align-items: center; gap: 6px; }
.tab[aria-selected="true"] { color: var(--ink); background: var(--soft); }
.badge { min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; display: inline-grid; place-items: center; padding: 0 5px; font-variant-numeric: tabular-nums; }
.fab { position: fixed; z-index: 7; right: max(16px, calc((100% - 560px) / 2 + 16px)); bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 1.7rem; line-height: 1;
  box-shadow: 0 4px 14px rgba(20, 50, 35, .25); }

dialog.sheet { border: 0; padding: 0; background: var(--surface); color: var(--ink); width: min(560px, 100% - 24px); max-height: calc(100% - 48px); border-radius: 18px; }
dialog.sheet::backdrop { background: rgba(10,20,15,.45); }
.sheet-body { padding: 18px 18px 20px; display: grid; gap: 14px; }
.field { display: grid; gap: 4px; }
.field label, .field .lbl { font-size: .8rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 11px; }
.field textarea { min-height: 88px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; background: var(--c); }
.swatches button[aria-pressed="true"] { border-color: var(--ink); }
.memo { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: .92rem; margin: 0; }
.stats { display: flex; gap: 18px; font-size: .84rem; color: var(--muted); }
.stats b { color: var(--ink); font-family: var(--f-display); font-size: 1.1rem; font-variant-numeric: tabular-nums; margin-right: 2px; }
.hist { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: .84rem; color: var(--muted); }
.err { color: var(--danger); font-size: .82rem; min-height: 1em; margin: 0; }

#toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 8px 16px; border-radius: 999px; font-size: .86rem; z-index: 20; max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: no-preference) { .req, .dish { transition: transform .15s ease; } .dish:hover { transform: translateY(-1px); } }

/* ---- PWA additions: sign-in, onboarding, settings ---- */
.card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 18px; }
.auth { margin-block: 12px 24px; }
.auth h2 { font-family: var(--f-display); font-size: 1.2rem; margin: 0; }
.stack { display: grid; gap: 12px; }
.lead { margin: 0; color: var(--muted); font-size: .9rem; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 7px 8px; font-weight: 700; font-size: .86rem; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.sheet hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.sheet h3.sub { font-family: var(--f-display); font-size: .95rem; margin: 0; }
.sheet h2.big { font-size: 1.35rem; }
.code-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.invite { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 1.4rem; letter-spacing: .18em; background: var(--bg); border-radius: 10px; padding: 6px 12px; user-select: all; }
.notice .actions { margin-top: 8px; }
.notice .stack { margin-top: 4px; }
.empty.wide { grid-column: 1 / -1; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
.members[hidden] { display: none !important; }

/* ---- requests for dishes that are not registered ---- */
.st-new { color: var(--accent); background: var(--soft); }
.recipe { margin: 4px 0 0; padding: 8px 10px; border-radius: 10px; border: 1px dashed var(--line); font-size: .88rem; display: grid; gap: 4px; min-width: 0; }
.recipe .who { font-size: .72rem; color: var(--muted); }
.recipe a { color: var(--accent); font-weight: 700; overflow-wrap: anywhere; justify-self: start; }
.recipe p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.btn.small { padding: 3px 10px; font-size: .78rem; font-weight: 500; }
h2.sec .n { white-space: nowrap; }
.wish-row.under-sec { justify-content: flex-start; margin: -4px 0 10px; }
.wish-row { display: flex; justify-content: flex-end; }
.empty .actions { margin-top: 10px; }

/* ---- fridge & shopping list ---- */
.cook { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px 10px 14px; position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; }
.cook::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c, var(--muted)); }
.cook-name { grid-column: 1; text-align: left; border: 0; background: none; padding: 0; font-family: var(--f-display); font-weight: 700; font-size: 1rem; color: var(--ink); overflow-wrap: anywhere; }
.cook .by { grid-column: 1; font-size: .76rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.cook .lack { grid-column: 1; margin: 2px 0 0; font-size: .82rem; color: var(--pending); overflow-wrap: anywhere; }
.cook > .btn { grid-column: 2; grid-row: 1 / span 3; }
.pantry-seg { margin-top: 26px; }
.seg .n { font-variant-numeric: tabular-nums; color: var(--muted); }
.add-row { display: flex; gap: 8px; margin-block: 12px; }
.add-row input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 9px 12px; }
.plist { display: grid; gap: 6px; }
.prow { background: var(--surface); border-radius: 12px; padding: 7px 8px 7px 12px; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow); }
.prow.low { outline: 1px dashed var(--pending); }
.pname { font-weight: 700; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.pacts { display: flex; gap: 6px; flex: none; }
.mini-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.mini-seg button { border: 0; background: transparent; padding: 3px 8px; font-size: .76rem; color: var(--muted); }
.mini-seg button[aria-pressed="true"] { background: var(--soft); color: var(--ink); font-weight: 700; }
.btn.small.on { background: var(--pending-bg); border-color: transparent; color: var(--pending); }
.check { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--accent); background: transparent; flex: none; }
.check:hover { background: var(--soft); }
.pextra { display: grid; gap: 8px; margin-top: 18px; }
.pextra .sub { font-family: var(--f-display); font-size: .92rem; margin: 0; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chips button.del { color: var(--danger); }
.tidy summary { cursor: pointer; font-size: .82rem; color: var(--muted); }
.tidy[open] { display: grid; gap: 8px; }
.ingr { display: grid; gap: 6px; }
.ingr .lbl { font-size: .8rem; font-weight: 700; color: var(--muted); }
.ing { border-radius: 999px; padding: 2px 10px; font-size: .84rem; }
.ing.has { background: var(--done-bg); color: var(--done); font-weight: 700; }
.ing.lack { border: 1px dashed var(--line); color: var(--muted); }
.dish .tag.ok { color: var(--done); }
.check-line { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
