/* くろぶちや 業務アプリ — スマホ（幅375px）で完結することを先に決め、PC は広げるだけ */
:root {
  --bg: #faf7f2;
  --card: #fff;
  --ink: #2b2620;
  --sub: #6f675d;
  --line: #e4ddd2;
  --pri: #7a4b1e;
  --pri-ink: #fff;
  --warn: #b3261e;
  --warn-bg: #fdecea;
  --ok: #2e7d32;
  --ok-bg: #e8f5e9;
  --info-bg: #f3eee6;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.55;
  padding-bottom: 72px;
}
a { color: var(--pri); }
.hide { display: none !important; }

/* 見出し */
header.top {
  position: sticky; top: 0; z-index: 20; background: var(--pri); color: var(--pri-ink);
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 48px;
}
header.top .brand { font-weight: 700; letter-spacing: .05em; }
header.top .ttl { flex: 1; font-size: 15px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.top .me { font-size: 12px; white-space: nowrap; }
header.top .me a { color: #fff; }
header.top .pcnav { display: none; }
nav.botnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex;
  background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
nav.botnav a {
  flex: 1; text-align: center; padding: 6px 0 8px; font-size: 11px; text-decoration: none; color: var(--sub);
  display: flex; flex-direction: column; align-items: center;
}
nav.botnav a .ic { font-size: 20px; line-height: 1.3; }
nav.botnav a.on { color: var(--pri); font-weight: 700; }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  nav.botnav { display: none; }
  header.top .me { display: block; }
  header.top .ttl { flex: 0 1 auto; }
  header.top .pcnav { display: flex; flex: 1; gap: 4px; }
  header.top .pcnav a { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 14px; }
  header.top .pcnav a .ic { margin-right: 4px; }
  header.top .pcnav a.on { background: rgba(255,255,255,.2); }
}

main { max-width: 960px; margin: 0 auto; padding: 12px; }
h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.muted { color: var(--sub); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* 入力 */
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 3px; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=search],
select, textarea {
  width: 100%; font-size: 16px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font-family: inherit;
}
textarea { resize: vertical; }
.btn {
  display: inline-block; font-size: 15px; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; font-family: inherit; min-height: 42px;
}
.btn.pri { background: var(--pri); color: var(--pri-ink); border-color: var(--pri); }
.btn.danger { color: var(--warn); border-color: #e7b3ae; }
.btn.small { font-size: 13px; padding: 5px 10px; min-height: 34px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 700px) { .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; } }

/* 絞り込みの帯 */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; }
.chip { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--pri); color: #fff; border-color: var(--pri); }

/* 一覧 */
.list { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.item:last-child { border-bottom: 0; }
.item .when { width: 74px; flex: none; font-weight: 700; font-size: 15px; }
.item .main { flex: 1; min-width: 0; }
.item .main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .side { text-align: right; font-size: 13px; color: var(--sub); flex: none; }
.dayhead { background: var(--info-bg); padding: 4px 12px; font-size: 13px; font-weight: 700; color: var(--sub); }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: #eee; flex: none; }
.thumb.none { display: flex; align-items: center; justify-content: center; font-size: 24px; }

.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--info-bg); color: var(--sub); margin-right: 3px; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.st-予約 { background: #fff3e0; color: #a15c00; }
.tag.st-提供済 { background: var(--ok-bg); color: var(--ok); }
.tag.st-取消 { background: #eee; color: #777; text-decoration: line-through; }
.errbox { background: var(--warn-bg); color: var(--warn); padding: 10px 12px; border-radius: 8px; margin: 8px 0; }
.warnbox { background: var(--warn-bg); color: var(--warn); padding: 8px 12px; border-radius: 8px; margin: 8px 0; font-size: 14px; }
.none { color: var(--sub); padding: 18px 12px; text-align: center; }

/* 献立 */
.slot { border-top: 1px solid var(--line); padding: 8px 0; }
.slot:first-child { border-top: 0; }
.slot .sl { font-size: 13px; font-weight: 700; color: var(--sub); }
.dish { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.dish.warn { background: var(--warn-bg); border-radius: 8px; padding: 6px; }
.dish .nm { flex: 1; min-width: 0; }
.ovl { font-size: 12px; color: var(--warn); }
.ovl.old { color: var(--sub); }

/* レシピ */
.rgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .rgrid { grid-template-columns: repeat(4, 1fr); } }
.rcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; text-decoration: none; color: inherit; }
.rcard img, .rcard .noimg { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #eee; }
.rcard .noimg { display: flex; align-items: center; justify-content: center; font-size: 36px; }
.rcard .t { padding: 6px 8px; font-weight: 700; font-size: 14px; }
.rcard .a { padding: 0 8px 8px; }
.hero { width: 100%; max-height: 360px; object-fit: cover; border-radius: 10px; display: block; cursor: zoom-in; }
.steps { padding-left: 0; list-style: none; counter-reset: st; }
.steps li { counter-increment: st; position: relative; padding: 8px 0 8px 36px; border-bottom: 1px dashed var(--line); }
.steps li::before { content: counter(st); position: absolute; left: 0; top: 8px; width: 26px; height: 26px; border-radius: 50%; background: var(--pri); color: #fff; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.sphotos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.sphotos img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; cursor: zoom-in; }
.ings { width: 100%; border-collapse: collapse; }
.ings td { padding: 5px 4px; border-bottom: 1px dotted var(--line); }
.ings td:last-child { text-align: right; white-space: nowrap; }
.edrow { display: flex; gap: 6px; margin-bottom: 6px; align-items: flex-start; }
.edrow .n { width: 24px; flex: none; padding-top: 10px; text-align: center; color: var(--sub); }

/* チャット */
.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - 48px - 72px); max-width: 960px; margin: 0 auto; }
@media (min-width: 900px) { .chat-wrap { height: calc(100dvh - 48px); } }
.chbar { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.feed { flex: 1; overflow-y: auto; padding: 12px; }
.msg { display: flex; margin-bottom: 10px; }
.msg.mine { justify-content: flex-end; }
.bub { max-width: 82%; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.msg.mine .bub { background: #fff3e0; border-color: #f0d8b5; }
.bub .who { font-size: 12px; font-weight: 700; color: var(--sub); }
.bub .tx { white-space: pre-wrap; word-break: break-word; }
.bub .mt { font-size: 11px; color: var(--sub); margin-top: 4px; }
.bub .mt a { margin-left: 8px; }
.bub .quote { display: block; border-left: 3px solid var(--line); padding-left: 6px; margin-bottom: 4px; font-size: 12px; color: var(--sub); text-decoration: none; }
.bub .atts img { max-width: 180px; max-height: 160px; border-radius: 8px; margin-top: 4px; cursor: zoom-in; display: block; }
.msg.gone { justify-content: center; font-size: 12px; color: var(--sub); }
.reacts { margin-top: 4px; display: flex; gap: 4px; }
.reacts button { font-size: 12px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 1px 8px; cursor: pointer; }
.reacts button.mine { background: #fff3e0; border-color: #e0b77a; }
.composer { border-top: 1px solid var(--line); background: #fff; padding: 8px 12px; }
.composer textarea { min-height: 44px; max-height: 140px; }
.replybar { font-size: 12px; color: var(--sub); display: flex; justify-content: space-between; padding-bottom: 4px; }
.older { text-align: center; margin-bottom: 8px; }

/* ダイアログ・知らせ */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: 90dvh; }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog .dhead { padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
dialog .dbody { padding: 12px 14px; overflow-y: auto; max-height: calc(90dvh - 120px); }
dialog .dfoot { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 50; padding: 10px 16px; border-radius: 8px; color: #fff; font-size: 14px; max-width: 90vw; display: none; }
.toast.ok { background: #2e7d32; }
.toast.err { background: var(--warn); }
.toast.info { background: #555; }
#lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 60; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
#lightbox img { max-width: 100vw; max-height: 85dvh; }
.fab { position: fixed; right: 16px; bottom: 84px; z-index: 15; border-radius: 999px; padding: 12px 18px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
@media (min-width: 900px) { .fab { bottom: 24px; } }
