/* 市場P財布 — スマホ前提の 1 枚（共通の部分は家族共有 app.css の写し）。部品の形は suite.css（ボタン・入力欄・小窓・暦と時刻の小窓）。色だけここで上書き */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --s-band: #1f9e8f; --s-accent: #1f9e8f; --s-deep: #157567;   /* 海の青緑（2026-11-19 仮の色。3 つを替えるだけで変わる） */
  --accent: #1f9e8f; --accent-weak: #e8f6f4;
  --border: #e3e6ea; --text: #222; --muted: #6b7280; --danger: #b91c1c;
  --tabbar: 66px;
  --sun: #e03e3e; --sat: #2f6fd6;
}
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; touch-action: manipulation; }   /* 2 回押しの拡大を止める（指で送る・つまむは可だが、つまみは common.js で止める） */   /* 横には絶対にスクロールさせない。上に引っぱっても Safari の「再読み込み」にしない（2026-10-17） */
html { overscroll-behavior-y: none; }   /* 引っぱり止めは html だけ。body にも付けると、Android の Chrome で縦に送れなくなる（overflow-x: hidden で body が送り箱扱いになり、そこで止まる。2026-11-05） */
body {
  font-family: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-size: 15px; color: var(--text); background: #fff; min-height: 100vh;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
button { -webkit-touch-callout: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0; }

/* ─── 上の帯（画面ごとの題） ─── */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px; display: flex; align-items: center; gap: 10px; min-height: 52px; }
.top h1 { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.top .spacer { flex: 1; }
.iconbtn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: #fff; color: #333;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; font-size: 18px; line-height: 1; }
.iconbtn:active { background: #f1f3f5; }
.iconbtn svg { width: 20px; height: 20px; }
.top .todaybtn { font-size: 12px; padding: 5px 10px; border-radius: 14px; border: 1px solid var(--border); background: #fff; }

/* ─── 下のタブ ─── */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--border); display: flex; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #8a8f98; text-decoration: none; font-size: 11px; }
.tabbar a { position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent; }   /* 波紋は札の中だけ */
/* 下の帯を押したときの波紋 (押した所から薄い灰の丸が広がって消える。2026-10-18) */
.tabbar .ripple { position: absolute; border-radius: 50%; background: rgba(0, 0, 0, .035); transform: scale(0); pointer-events: none;
  animation: tabripple .45s ease-out forwards; }
@keyframes tabripple { 0% { transform: scale(0); opacity: 1; } 70% { opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tabbar .ripple { animation-duration: .2s; } }
.tabbar .tabbadge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ef4444; color: #fff;
  font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }   /* 急ぎの数（どの画面でも） */
.tabbar .tabbadge[hidden] { display: none; }
.tabbar a svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--s-deep); font-weight: 700; }
.tabbar a.active svg { stroke-width: 2.2; }

/* ─── 共通の中身 ─── */
.wrap { padding: 8px 16px 24px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.card h3 { font-size: 15px; margin-bottom: 8px; }
label.fl { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=date], input[type=time], input[type=url], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 16px; background-color: #fff; }   /* background の省略形にすると suite の欄の絵（時計）が消える */
input[type=text], input[type=date], input[type=time], input[type=url], select { height: auto; line-height: 1.3; }   /* suite の height:36px と上の padding がぶつかり、iPhone の select で文字が半分切れた（2026-10-17） */
input[data-date], input[data-time] { background-color: #fff; }
textarea { resize: vertical; }
.btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btns button { flex: 1; padding: 12px; font-size: 15px; border-radius: 10px; }
.btns button.danger { flex: 0 0 auto; }
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; object-fit: cover; flex: none; }
.fab { position: fixed; right: 18px; bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); z-index: 25;
  width: 58px; height: 58px; border-radius: 50%; background: var(--accent); color: #fff; border: 0; font-size: 34px; line-height: 1;
  box-shadow: 0 6px 18px rgba(31,158,143,.4); display: flex; align-items: center; justify-content: center; padding: 0 0 3px; }
.fab:active { transform: scale(.96); }
.empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 14px; }
#flash { position: fixed; top: auto; right: auto; left: 50%; bottom: calc(var(--tabbar) + 90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(10px);
  background: rgba(34,34,34,.92); color: #fff; padding: 9px 16px; border-radius: 20px; font-size: 13px; opacity: 0; transition: .2s; z-index: 3000; pointer-events: none; max-width: 90vw; }   /* 小窓 (2000)・暦や時刻の層 (2600) より手前。小窓の裏に隠れて、保存の失敗が「無反応」に見えた (2026-11-10) */
#flash.show { opacity: 1; transform: translateX(-50%); }
#flash.err { background: #b91c1c; }

/* 下からせり上がる小窓 */
.modal { overscroll-behavior: contain; }   /* 小窓の中で引っぱっても外（ページ）に伝えない */
.modal.bottom { align-items: flex-end; padding: 0; }
.modal.bottom { background: rgba(0, 0, 0, 0); transition: background-color .2s ease-out; }
.modal.bottom.in { background: rgba(0, 0, 0, .35); }
.modal.bottom.out { background: rgba(0, 0, 0, 0); transition: background-color .18s ease-in; }   /* 小窓が下がるのと同時に薄暗さも消す */
.modal.bottom .sheet { max-width: 560px; border-radius: 16px 16px 0 0; padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow: auto; transform: translateY(100%); transition: transform .2s ease-out; }
.modal.bottom.in .sheet { transform: none; }
.modal.bottom .sheet > * { flex-shrink: 0; }   /* 小窓が 92vh を超えても中身 (メモの欄など) を潰さず、小窓の中で送る (2026-10-31 参加の行を足してメモが半分隠れた) */
.modal.bottom.out .sheet { transform: translateY(100%); transition: transform .18s ease-in; }
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: #ddd; margin: -4px auto 4px; }
.sheet .fl:first-of-type { margin-top: 0; }
.sheet .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet .actions { margin-top: 10px; }
.sheet .actions button { padding: 11px 16px; }

/* 日付の欄: 中に暦の絵。押すと上に層で暦が出る（calendar.js の DateLayer。小窓の中に流し込む suite の暦は使わない。2026-10-17） */
.datefield { position: relative; }
.datefield input { padding-right: 40px; cursor: pointer; }
.datefield .dicon { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: none; padding: 0; color: #555; display: inline-flex; align-items: center; justify-content: center; }
.datefield .dicon svg { width: 20px; height: 20px; }
.modal.datelayer { z-index: 2600; align-items: center; padding: 16px; background: rgba(0,0,0,.45); }
.modal.datelayer .sheet { max-width: 340px; border-radius: 14px; padding: 14px 14px 10px; transform: none; }
.dl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dl-head .ym { font-size: 17px; font-weight: 700; }
.dl-head .nav { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: #fff; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.dl-dow, .dl-days { display: grid; grid-template-columns: repeat(7, 1fr); }
.dl-dow span { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0 6px; }
.dl-dow span:first-child { color: var(--sun); } .dl-dow span:last-child { color: var(--sat); }
.dl-days button { display: block; width: 40px; height: 40px; margin: 1px auto; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text); font-size: 15px; }
.dl-days .out { color: #c4c8cd; }
.dl-days .sun:not(.out), .dl-days .hol:not(.out) { color: var(--sun); } .dl-days .sat:not(.out) { color: var(--sat); }
.dl-days .dis { color: #c4c8cd !important; text-decoration: line-through; pointer-events: none; }
.dl-days .today { box-shadow: inset 0 0 0 1.5px #222; }
.dl-days .on, .dl-days .on.sun, .dl-days .on.sat, .dl-days .on.hol { background: var(--accent); color: #fff; }
/* 期間: 間の日は薄い緑の帯、両端は丸。帯は左右いっぱいに伸ばして繋げる */
.dl-days .mid, .dl-days .mid.sun, .dl-days .mid.sat, .dl-days .mid.hol { background: var(--accent-weak); border-radius: 0; width: 100%; color: var(--s-deep); }
.dl-days .r-start { background: linear-gradient(to right, transparent 50%, var(--accent-weak) 50%); width: 100%; border-radius: 0; }
.dl-days .r-end { background: linear-gradient(to left, transparent 50%, var(--accent-weak) 50%); width: 100%; border-radius: 0; }
.dl-days .r-start::after, .dl-days .r-end::after { content: attr(data-d); }
.dl-days .r-start, .dl-days .r-end { position: relative; color: #fff; }
.dl-days .r-start::before, .dl-days .r-end::before { content: ""; position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--accent); z-index: -1; }
.dl-days .r-start, .dl-days .r-end { isolation: isolate; }
.datefield.tm { margin-top: 6px; }
.tl-head { text-align: center; margin-bottom: 8px; }
.tl-head .ym { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tl-grid { display: grid; gap: 6px; grid-template-columns: 34px repeat(6, 1fr); align-items: stretch; }   /* 見出し 1 列 + 6 列 (2026-10-18) */
.tl-grid .tl-lbl { display: flex; align-items: center; font-size: 12px; color: var(--muted); }
.tl-grid .tl-lbl.two { grid-row: span 2; }
.tl-grid button { padding: 6px 0 5px; border-radius: 8px; background: #f3f4f6; font-size: 15px; line-height: 18px; font-variant-numeric: tabular-nums; }
.tl-grid.hours button small { display: block; font-size: 10px; line-height: 12px; color: var(--muted); min-height: 12px; }   /* 午後の 12 時間の呼び方 (13 → 1) */
.tl-grid.hours button.night { color: #9aa0a6; }   /* 0〜5 時は夜中。薄く */
.tl-grid.mins button { padding: 10px 0; }
.tl-grid.mins button.big { font-size: 17px; font-weight: 700; }   /* 00・30 */
.tl-grid.mins button.mid { font-weight: 600; }                    /* 15・45 */
.tl-grid.mins button.lite { color: #8a9096; }                     /* 05・10・20 … */
.tl-grid button.on { background: var(--accent); color: #fff; font-weight: 700; }
.tl-grid button.on small { color: rgba(255,255,255,.85); }
.tl-grid button:disabled { color: #c3c7cc; background: #f8f9fa; }   /* 始まりより前の時刻（終わりの欄）*/
.tl-grid button:disabled small { color: #d5d8dc; }
.tl-sep { font-size: 12px; color: var(--muted); margin: 10px 0 6px; }
.dl-sum { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 14px; margin-top: 8px; }
.dl-sum .hint { margin: 0 0 0 auto; }
.dl-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.dl-foot .spacer { flex: 1; }
.dl-foot button { padding: 8px 14px; }

/* 切り替え（家族／自分だけ・終日） */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 16px; border: 1px solid var(--border); background: #fff; font-size: 13px; color: #444; }
.chip.on { background: var(--accent-weak); border-color: var(--accent); color: var(--s-deep); font-weight: 700; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: #d6d9de; position: relative; transition: .15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { left: 21px; }

/* ─── その他 ─── */
.more h2 { font-size: 13px; color: var(--muted); margin: 18px 0 6px; font-weight: 700; }
.mrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f0f1f3; }
.mrow:last-child { border-bottom: 0; }
.mrow .grow { flex: 1; min-width: 0; }
.mrow .n { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .sub { font-size: 12px; color: var(--muted); }
.mrow button.mini { padding: 5px 10px; font-size: 12px; }
.mrow .move { display: flex; gap: 4px; }
/* ─── ログイン・招待 ─── */
.center { max-width: 420px; margin: 0 auto; padding: 60px 20px 40px; text-align: center; }
.center .logo { width: 84px; height: 84px; border-radius: 22px; margin: 0 auto 14px; display: block; }
.center h1 { font-size: 22px; margin-bottom: 6px; }
.center p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.linebtn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 14px; border-radius: 10px; background: #06c755; color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; border: 0; }
.linebtn:active { background: #05a847; }
.center .card { text-align: left; }
/* ホーム画面に足す の手順 (2026-10-17) */
.steps { margin: 8px 0 0; padding-left: 22px; font-size: 14px; line-height: 1.5; }
.steps li { margin: 4px 0; }
.steps b { font-weight: 700; }
.row[hidden], .hint[hidden] { display: none; }   /* hidden が .row の flex に負けていた (2026-10-17) */
.btns a.primary { flex: 1; display: block; text-align: center; text-decoration: none; padding: 12px; font-size: 15px; line-height: 20px; border-radius: 10px; background: var(--s-accent); color: #fff; font-weight: 700; }   /* リンクをボタンの見た目で (ブラウザで開く) */


/* ─── 市場P財布の画面 ─── */
@media (min-width: 700px) { #view, .tabbar { max-width: 640px; margin-left: auto; margin-right: auto; } .tabbar { border: 1px solid var(--border); border-bottom: 0; } .fab { right: calc(50% - 300px); } }
.qr { display: block; width: 220px; max-width: 100%; margin: 6px auto; }
input.money { font-size: 22px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
b.in, .amt.in { color: #18794e; } b.out, .amt.out { color: #c2410c; }
.amt { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 3 つの財布 */
.wallets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wallet { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 10px 8px; border: 1px solid var(--border); border-radius: 12px; background: #fff; text-align: left; min-width: 0; color: var(--text); }
.wallet:active { background: var(--accent-weak); }
.wallet .wn { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 400; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wallet .wn svg { width: 15px; height: 15px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wallet .wb { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.wallet .wb.neg { color: #c2410c; }
.wallet .wc { font-size: 10px; color: var(--muted); font-weight: 400; }
.totalline { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 8px 2px 14px; }
.totalline b { color: var(--text); font-size: 14px; }
.card.unsettled { border-color: #f3c98b; background: #fffaf2; }
.card.unsettled h3 { display: flex; align-items: center; gap: 6px; }
.card.unsettled .mrow { border-bottom-color: #f6e6cc; }

/* 行事の絞り・収支の 1 行 */
.filterchips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 8px; scrollbar-width: none; }
.filterchips::-webkit-scrollbar { display: none; }
.filterchips .chip { flex: none; white-space: nowrap; }
.sumline { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); margin: 4px 2px 6px; }
.sumline b { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }

/* 行の一覧 */
.dayhead { font-size: 12px; color: var(--muted); font-weight: 700; margin: 14px 2px 2px; }
.erow { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 2px; border: 0; border-bottom: 1px solid #f0f1f3; border-radius: 0; background: none; text-align: left; color: var(--text); font-weight: 400; }
.erow:active { background: #f6f7f8; }
.erow .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.erow .t { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erow .payee { font-size: 12px; color: var(--muted); margin-left: 8px; }
.erow .sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.erow .amt { font-size: 16px; font-weight: 700; }
.erow .amt.move { color: var(--muted); font-weight: 400; }
.erow .clip { width: 14px; height: 14px; stroke: var(--s-deep); fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }

/* ＋ の 4 択 */
.choices { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
.choices button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; text-align: left; color: var(--text); }
.choices button:active { background: var(--accent-weak); border-color: var(--accent); }
.choices b { font-size: 16px; } .choices span { font-size: 12px; color: var(--muted); font-weight: 400; }

/* 小窓の中 */
.sheet h2 { margin-bottom: 4px; }
.sheet .chips { gap: 6px; }
.sheet .chip { padding: 9px 13px; font-size: 14px; }
.sheet [data-chips][data-locked] .chip { opacity: .6; }
.recbox { margin: 6px 0 2px; }
.recs { display: flex; gap: 8px; flex-wrap: wrap; }
.recs:not(:empty) { margin-bottom: 8px; }
.rec { width: 64px; height: 84px; padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #f6f7f8; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); }
.rec img { width: 100%; height: 100%; object-fit: cover; }
.recadd { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px; border: 1.5px dashed var(--accent); border-radius: 12px; color: var(--s-deep); font-weight: 700; font-size: 14px; background: var(--accent-weak); cursor: pointer; }
.recadd[hidden] { display: none; }
.recadd svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linejoin: round; }
.recbox .hint { margin-top: 6px; color: var(--s-deep); }
.recbox .hint.warn, .lockhint { color: #b45309; }
.spin { width: 20px; height: 20px; border: 2.5px solid #d6d9de; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.recview { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: 8px; }
.diffbox { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #f6f7f8; font-size: 13px; }
.diffbox b { font-size: 15px; font-variant-numeric: tabular-nums; }
.settleline { margin-top: 12px; font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.metaline { margin-top: 10px; }
.evcard h3 { margin-bottom: 2px; }
.evcard .sumline { margin: 10px 0 2px; }
.top .spacer { flex: 1; }
