/* 経費アプリのスタイル（2）画面ごと。S-1 ホーム（F1）/ S-2 内容を確かめる（F2）/ S-3 サブスク（F3）/
   S-4 集計（F4）/ S-5 記録の一覧 / S-6 要確認 / S-8 設定。寸法はキャンバス（390×844）を元にした。 */

/* ---------- S-1 ホーム ---------- */
.home .hero { height: calc(max(10px, var(--sat)) + 322px); }
.home .bar .date { flex: 1; font-size: 15px; font-weight: 700; }
.lead { margin-top: 16px; text-align: center; }
.lead .cap { font-size: 14px; font-weight: 500; color: var(--muted); }
.lead .pill { margin-top: 6px; }
.stack { position: absolute; left: 16px; right: 16px; bottom: 38px; }
.stack .sl1 { display: block; height: 8px; margin: 0 30px; border-radius: 12px 12px 0 0; background: var(--sliver); }
.stack .sl2 { display: block; height: 8px; margin: 0 15px; border-radius: 14px 14px 0 0; background: var(--sliver); }
.glass {
  display: flex; padding: 12px 0; border-radius: 20px; background: var(--glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.glass > div { flex: 1; min-width: 0; padding: 0 16px; }
.glass > div + div { border-left: 1px solid var(--line); }
.glass .k { font-size: 12px; color: var(--muted); white-space: nowrap; }
.glass .v { font-size: 17px; font-weight: 700; white-space: nowrap; }
.home .paper .scroll { padding-bottom: 6px; }
.notice {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; margin: 0 0 6px; padding: 0 12px;
  border-radius: 14px; background: var(--soft); color: var(--soft-ink); font-size: 13px; font-weight: 600; text-align: left;
}
.notice .icon { width: 18px; height: 18px; }
.notice span { flex: 1; }
.dock { flex: none; padding: 4px 16px max(14px, var(--sab)); background: #fff; }
.dock .tpl-label { margin: 0 0 6px 2px; font-size: 12px; font-weight: 600; color: var(--gray); }
.tpls { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 10px; padding: 0 16px; scrollbar-width: none; }
.tpls::-webkit-scrollbar { display: none; }
.tpls .chip { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.peek { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0 4px 8px; font-size: 12px; color: var(--gray); }
.peek b { color: var(--text); font-weight: 600; }
/* 下の入力欄（ホーム・サブスク）に書いている間。iOSが画面を押し上げた分（--vt）だけ中身を下げて
   日付やボタンをステータスバーに潜らせず、キーボードに隠れる分（--kb）だけ下を空ける */
.screen:has(.dock input:focus) { padding-top: var(--vt, 0px); padding-bottom: var(--kb, 0px); }
:root.keyboard .dock { padding-bottom: 8px; }
/* キーボードが出ている間は、色の部分を上の行だけにして、記録の一覧と入力欄を広く見せる */
:root.keyboard .screen:has(.dock input:focus) .hero { height: auto; padding-bottom: 32px; }
:root.keyboard .screen:has(.dock input:focus) .hero > :not(.bar) { display: none; }

/* ---------- S-2 内容を確かめる（サブスクの登録も同じ形） ---------- */
.confirm .hero { height: calc(max(10px, var(--sat)) + 214px); text-align: center; }
.quote {
  display: inline-block; max-width: 92%; margin-top: 2px; padding: 5px 14px; border-radius: 16px;
  background: var(--pill); font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.amount-line { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 4px; }
.amount-line .round { width: 40px; height: 40px; }
.amount-line .round .icon { width: 18px; height: 18px; }
.amount-line .big.blank { color: var(--yen); font-size: 40px; }
.amount-sub { min-height: 20px; font-size: 13px; font-weight: 600; color: var(--muted); }
.img-row { display: flex; align-items: center; gap: 12px; padding: 2px 0 12px; border-bottom: 1px solid var(--border-2); }
.tile { width: 52px; height: 52px; flex: none; border-radius: 16px; display: grid; place-items: center; overflow: hidden; background: var(--soft); color: var(--soft-ink); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.img-row .main { flex: 1; min-width: 0; text-align: left; }
.img-row .k { font-size: 13px; color: var(--gray); }
.img-row .v { font-size: 14px; font-weight: 600; }
.img-row .ghost { min-height: 40px; padding: 0 14px; font-size: 13px; }
.desc { padding: 12px 0 8px; border-bottom: 1px solid var(--border-2); }
.desc label { display: block; font-size: 13px; color: var(--gray); }
.desc input { width: 100%; height: 38px; padding: 0; border: 0; outline: none; background: none; font-size: 16px; font-weight: 700; color: var(--text); }
.desc input::placeholder { color: var(--faint); font-weight: 400; }
.acc { padding: 12px 0; border-bottom: 1px solid var(--border-2); }
.acc .head { font-size: 13px; color: var(--gray); }
.acc .head b { font-weight: 600; color: var(--text); }
.acc .chips { margin-top: 10px; gap: 6px; }
.acc .chip { padding: 0 14px; }
.acc .more { width: 52px; padding: 0; justify-content: center; }
.field { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 6px 0; border-bottom: 1px solid var(--border-2); text-align: left; }
.field .k { width: 64px; flex: none; font-size: 13px; color: var(--gray); }
.field .v { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; }
.field .v small { display: block; font-size: 12px; font-weight: 400; color: var(--gray); }
.field .v.blank { color: var(--faint); font-weight: 400; }
.field .chev { width: 18px; height: 18px; color: #B9B9C1; }
.field.static { cursor: default; }
.subedit .field .k { width: 84px; }

/* ---------- S-3 サブスク ---------- */
.subs .hero { height: calc(max(10px, var(--sat)) + 246px); text-align: center; }
.subs .cap { margin-top: 12px; font-size: 14px; font-weight: 500; color: var(--muted); }
.subs .big .plus { margin: 0 8px; font-size: 30px; color: var(--yen); }
.subs .big .usd { font-size: 40px; }
.subs .pill { margin-top: 8px; max-width: 100%; }
.sub-note { margin: 14px 2px 4px; font-size: 12px; line-height: 1.7; color: var(--gray); }
.ended .row { opacity: .55; }

/* ---------- S-4 集計 ---------- */
.summary { background: var(--full); }
.summary .top { flex: none; padding: max(10px, var(--sat)) 16px 0; color: var(--ink); }
.seg-wrap { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 6px; }
.seg-wrap .round { width: 44px; height: 44px; background: transparent; }
.seg { display: flex; width: 224px; height: 44px; padding: 4px; border-radius: 22px; background: var(--seg); }
.seg button { flex: 1; border-radius: 18px; text-align: center; font-size: 14px; font-weight: 700; color: var(--ink); }
.seg button.on { background: var(--ink); color: #fff; }
.seg.light { width: 100%; background: var(--tile); }
.seg.light button.on { background: var(--black); }
.bubbles { position: relative; flex: 1; min-height: 120px; margin: 8px 12px; }
.bub {
  position: absolute; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 4px; text-align: center; color: var(--ink); border: 1px solid var(--bubble-line);
  background: radial-gradient(circle at 32% 26%, var(--sheen) 0%, rgba(255, 255, 255, 0) 55%), var(--bubble);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.bub b { font-size: 12px; font-weight: 700; line-height: 1.3; white-space: nowrap; }
.bub span { font-size: 12px; font-weight: 600; color: var(--muted); }
.bub.pick { background: var(--ink); border-color: var(--ink); color: #fff; }
.bub.pick span { color: rgba(255, 255, 255, .82); }
.bub.small b { display: none; }
.bub-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); }
.card { flex: none; margin: 0 12px max(12px, var(--sab)); padding: 18px 18px 16px; border-radius: 28px; background: #fff; box-shadow: var(--card-shadow); }
.card .head { display: flex; align-items: center; justify-content: space-between; }
.card .head p { font-size: 14px; font-weight: 600; color: var(--gray); }
.card .total { margin-top: 2px; font-size: 36px; font-weight: 700; line-height: 1.2; color: var(--text); }
.card .total .y { margin-right: 2px; font-size: 20px; color: var(--gray); }
.card .hint { margin-top: 2px; font-size: 12px; color: var(--gray); }
.tiles { display: flex; gap: 10px; margin-top: 14px; }
.tiles button { flex: 1; min-height: 64px; padding: 10px 14px; border-radius: 18px; display: flex; flex-direction: column; justify-content: center; background: var(--tile); text-align: left; }
.tiles button.soft { background: var(--soft); color: var(--soft-ink); }
.tiles small { font-size: 12px; font-weight: 600; opacity: .85; }
.tiles b { font-size: 16px; font-weight: 700; }
.kessan { display: flex; align-items: center; gap: 10px; min-height: 46px; border-bottom: 1px solid var(--border-2); }
.kessan .no { width: 26px; flex: none; color: var(--gray); font-size: 15px; }
.kessan .name { flex: 1; font-size: 15px; }
.kessan .name small { display: block; font-size: 11px; color: var(--gray); }
.kessan .yen { font-size: 15px; font-weight: 700; }
.kessan.zero .name, .kessan.zero .yen { color: var(--faint); font-weight: 400; }
.kessan.total { border-bottom: 0; border-top: 2px solid var(--text); margin-top: 4px; }

/* ---------- S-5 記録の一覧 / S-6 要確認 / S-8 設定 ---------- */
.page .hero { height: calc(max(10px, var(--sat)) + 84px); }
.search { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; border-radius: 24px; background: var(--tile); color: var(--gray); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; font-size: 16px; color: var(--text); }
.filters { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.group-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 16px; padding: 4px 2px 6px;
  border-bottom: 1px solid var(--border-2); font-size: 13px; font-weight: 700; color: var(--gray);
}
.group-head:first-child { margin-top: 4px; }
.set-group { margin-top: 20px; }
.set-group:first-child { margin-top: 4px; }
.set-group h3 { margin: 0 2px 2px; font-size: 13px; font-weight: 700; color: var(--gray); }
.set-group .field .k { width: auto; flex: 1; font-size: 15px; color: var(--text); font-weight: 600; }
.set-group .field .v { flex: none; max-width: 55%; text-align: right; font-size: 13px; font-weight: 400; color: var(--gray); }
.tpl-row { display: flex; align-items: center; gap: 8px; min-height: 56px; border-bottom: 1px solid var(--border-2); }
.tpl-row .main { flex: 1; min-width: 0; }
.tpl-row .main b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-row .main small { font-size: 12px; color: var(--gray); }
.tpl-row .mini { width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; color: var(--gray); }
.tpl-row .mini.on { color: var(--accent); background: var(--soft); }
.about { font-size: 13px; line-height: 1.8; color: var(--gray); }

/* ---------- 編集のシート ---------- */
.amt-input { display: flex; align-items: center; gap: 8px; height: 72px; padding: 0 18px; border-radius: 18px; border: 1px solid var(--border); }
.amt-input:focus-within { border-color: var(--accent); }
.amt-input .cur { font-size: 26px; font-weight: 600; color: var(--gray); }
.amt-input input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; font-size: 34px; font-weight: 700; color: var(--text); }
.split { display: flex; gap: 10px; margin-top: 12px; }
.split div { flex: 1; padding: 10px 14px; border-radius: 14px; background: var(--tile); }
.split small { display: block; font-size: 12px; color: var(--gray); }
.split b { font-size: 17px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.days button { height: 44px; border-radius: 12px; background: var(--tile); text-align: center; font-weight: 600; }
.days button.on { background: var(--accent); color: #fff; }
.days .wide { grid-column: span 3; }

/* 高さが足りない時だけ詰める（iOSのホーム画面アプリでは @media の高さが当てにならないため、アプリの実高さで判定） */
@container app (max-height: 720px) {
  .home .hero { height: calc(max(10px, var(--sat)) + 262px); }
  .home .big, .confirm .big, .subs .big { font-size: 46px; }
  .lead { margin-top: 4px; }
  .stack .sl1, .stack .sl2 { display: none; }
  .confirm .hero { height: calc(max(10px, var(--sat)) + 196px); }
  .subs .hero { height: calc(max(10px, var(--sat)) + 220px); }
}
@container app (max-height: 600px) {
  .home .hero { height: calc(max(10px, var(--sat)) + 214px); }
  .home .big { font-size: 40px; }
  .stack { bottom: 32px; }
  .glass { padding: 8px 0; }
}
