:root {
  --bg1: #fff8f3;
  --bg2: #ffe9de;
  --card: rgba(255, 255, 255, 0.86);
  --ink: #2b211d;
  --muted: #8a7368;
  --line: rgba(104, 67, 50, 0.14);
  --accent: #ff765f;
  --accent2: #ffb36b;
  --accentDark: #b94131;
  --green: #4c8a6a;
  --shadow: 0 18px 50px rgba(92, 50, 31, 0.14);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 179, 107, .34), transparent 34%),
    radial-gradient(circle at 100% 12%, rgba(255, 118, 95, .22), transparent 30%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.app {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(36px + env(safe-area-inset-bottom));
}
.hero { padding: 12px 2px 16px; }
.pill {
  display: inline-flex;
  padding: 8px 12px;
  border: 1px solid rgba(185, 65, 49, .18);
  border-radius: 999px;
  background: rgba(255,255,255,.62);
  color: var(--accentDark);
  font-size: 13px;
  font-weight: 800;
}
h1 {
  margin: 14px 0 10px;
  font-size: clamp(38px, 11vw, 68px);
  line-height: .96;
  letter-spacing: -.06em;
}
.lead { margin: 0; color: var(--muted); line-height: 1.75; font-size: 15.5px; }
.card, .settlementCard {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.card { padding: 18px; }
.settlementCard {
  position: relative;
  overflow: hidden;
  padding: 22px;
  color: white;
  background: linear-gradient(135deg, #34221b, #714236 55%, #d76754);
}
.settlementCard:after {
  content: "";
  position: absolute;
  right: -42px;
  top: -42px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.label { margin: 0; color: rgba(255,255,255,.76); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.label.dark { color: var(--muted); }
.settlementCard h2 { position: relative; margin: 10px 0 8px; font-size: clamp(26px, 8vw, 46px); line-height: 1.12; letter-spacing: -.04em; }
.settlementCard p { position: relative; }
#subSummary { margin: 0 0 16px; color: rgba(255,255,255,.78); line-height: 1.6; }
.meter { height: 9px; border-radius: 999px; background: rgba(255,255,255,.22); overflow: hidden; margin: 12px 0 14px; }
.meter span { display: block; width: 50%; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #fff, #ffe2bc); transition: width .25s ease; }
.sectionTitle { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sectionTitle h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.sectionTitle p, .saveStatus { margin: 0; color: var(--muted); font-size: 12px; font-weight: 800; }
.nameGrid, .form { display: grid; gap: 12px; }
.nameGrid { grid-template-columns: 1fr 1fr; }
.form { grid-template-columns: 1fr; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 800; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 14px;
  background: rgba(255,255,255,.94);
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
input:focus, select:focus { border-color: rgba(255, 118, 95, .64); box-shadow: 0 0 0 4px rgba(255, 118, 95, .13); }
button {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px 14px;
  background: white;
  color: var(--ink);
  font-weight: 900;
}
.primary {
  border: none;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 12px 26px rgba(255, 118, 95, .28);
}
.secondary { background: #fff6f1; color: var(--accentDark); }
.ghost { position: relative; width: 100%; background: rgba(255,255,255,.16); color: white; border-color: rgba(255,255,255,.25); }
.full { width: 100%; margin-top: 12px; }
.quickChips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; margin: 0 -2px; }
.quickChips button { flex: 0 0 auto; padding: 10px 12px; border-radius: 999px; color: var(--accentDark); background: #fff4ee; }
.insightCard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.insightCard strong { display: block; margin-top: 5px; font-size: 17px; }
.row { align-items: center; }
.actions { display: flex; gap: 8px; }
.mini { padding: 9px 11px; border-radius: 14px; font-size: 13px; }
.danger { color: #a73535; }
.expenseList { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.expenseItem {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 250, 247, .92);
}
.expenseMain { min-width: 0; }
.expenseMain strong { display: block; margin-bottom: 5px; font-size: 16px; }
.expenseMeta { color: var(--muted); font-size: 12px; line-height: 1.5; }
.amount { text-align: right; font-size: 18px; font-weight: 950; letter-spacing: -.03em; }
.deleteBtn { margin-top: 7px; padding: 8px 10px; border-radius: 12px; font-size: 12px; color: #9a4038; }
.empty { padding: 22px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 22px; background: rgba(255,255,255,.54); line-height: 1.7; }
@media (max-width: 520px) {
  .app { padding-left: 12px; padding-right: 12px; }
  .nameGrid, .insightCard { grid-template-columns: 1fr; }
  .card { padding: 16px; border-radius: 24px; }
  .settlementCard { border-radius: 26px; }
}
.settingsCard summary {
  cursor: pointer;
  font-weight: 900;
  font-size: 18px;
  list-style: none;
}
.settingsCard summary::-webkit-details-marker { display: none; }
.settingsCard summary:after { content: "開く"; float: right; color: var(--accentDark); font-size: 12px; padding-top: 4px; }
.settingsCard details[open] summary:after { content: "閉じる"; }
.settingsBody { display: grid; gap: 14px; padding-top: 16px; }
input[type="color"] { min-height: 48px; padding: 6px; }
.categoryList { display: flex; gap: 8px; flex-wrap: wrap; }
.categoryPill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 999px;
  background: #fff4ee;
  color: var(--accentDark);
  font-size: 13px;
  font-weight: 900;
}
.categoryPill button {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  color: #9a4038;
}
.expenseItem {
  position: relative;
  grid-template-columns: auto 1fr auto;
  border-left: 8px solid var(--payer-color);
  background: linear-gradient(90deg, color-mix(in srgb, var(--payer-color) 13%, white), rgba(255,250,247,.94) 46%);
}
.payerBadge {
  align-self: start;
  max-width: 84px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--payer-color);
  color: white;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--payer-color) 28%, transparent);
}
@media (max-width: 520px) {
  .expenseItem { grid-template-columns: 1fr auto; }
  .payerBadge { grid-column: 1 / -1; max-width: 100%; justify-self: start; }
}
.deferMeta {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: var(--accentDark);
  font-size: 12px;
  font-weight: 900;
}
.itemActions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.itemActions button {
  padding: 7px 9px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--ink);
  background: rgba(255,255,255,.82);
}
.periodBar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.periodBar strong { display: block; margin-top: 4px; font-size: 15px; }
.soft { background: rgba(255,255,255,.62); box-shadow: 0 10px 28px rgba(92,50,31,.08); }
.hint { color: var(--accentDark); font-size: 11px; }
body:has(.app) { background-position: center; }
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,.94);
  color: var(--ink);
  resize: vertical;
}
input[type="range"] { padding: 8px 0; box-shadow: none; }
body { background-repeat: no-repeat; background-position: center; }
.shareActions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.miniSelect { max-width: 150px; padding: 9px 10px; border-radius: 14px; font-size: 13px; }
.form label, .nameGrid label { min-width: 0; }
input, select, textarea { min-width: 0; max-width: 100%; }
.editPanel { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
@media (max-width: 520px) { .shareActions { grid-template-columns: 1fr; } .actions { flex-wrap: wrap; } .miniSelect { max-width: 100%; width: 100%; } }
input[type="date"], input[type="number"], select { width: 100%; min-width: 0; }
.form { overflow: hidden; }
.form > label { width: 100%; }
.scheduleMeta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}
/* v10: iPhone-safe date and copy panel */
.copyPanel textarea { font-size: 15px; line-height: 1.55; }
input#date, input#editDate {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.form { grid-template-columns: minmax(0, 1fr); }
.toast {
  position: fixed;
  z-index: 20;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(43,33,29,.92);
  color: white;
  font-weight: 900;
  box-shadow: var(--shadow);
}
.splitRows { display: grid; gap: 10px; }
.splitRow { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.splitRow input, .splitRow select { width: 100%; }
@media (max-width: 520px) { .splitRow { grid-template-columns: 1fr; } }
.originMeta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.splitChips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}
.splitLabel {
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
}
.splitChip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.74);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}
.splitChip b { color: var(--muted); }
.splitChip.current {
  background: color-mix(in srgb, var(--accent) 18%, white);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
}
/* v14 compact mobile list */
.splitBlock { margin-top: 8px; display: grid; gap: 6px; }
.splitBlock .splitLabel { display: block; }
.splitChips { display: grid; grid-template-columns: 1fr; gap: 6px; align-items: stretch; }
.splitChip { justify-content: space-between; width: 100%; border-radius: 14px; }
.itemActions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.itemActions button { padding: 9px 6px; font-size: 11.5px; white-space: nowrap; }
.expenseMeta { font-size: 11.5px; }
.originMeta { font-size: 11.5px; opacity: .86; }
.deferMeta { font-size: 11.5px; }
@media (max-width: 520px) {
  .expenseItem { gap: 10px; padding: 13px; }
  .amount { font-size: 17px; }
  .itemActions { grid-template-columns: repeat(3, 1fr); }
}
/* v15 simplified product surface */
.hero { padding-bottom: 4px; }
.hero h1 { margin-top: 4px; margin-bottom: 2px; }
.settlementCard h2 { margin-top: 6px; }
.insightCard { margin-top: 10px; box-shadow: 0 10px 28px rgba(92,50,31,.08); }
.insightCard strong { font-size: 18px; }
.sectionTitle p { font-size: 12px; }
/* v16 clearer labels */
.expenseMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.expenseMeta span {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.62);
}
/* v17: summary belongs to list */
.listTitle { margin-bottom: 10px; }
.listSummary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 4px 0 14px;
  padding: 12px;
  border-radius: 20px;
  background: rgba(255,255,255,.56);
  border: 1px solid var(--line);
}
.listSummary strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  letter-spacing: -.02em;
}
@media (max-width: 520px) {
  .listTitle { align-items: stretch; }
  .listSummary { grid-template-columns: 1fr 1fr; }
  .listSummary div:first-child { grid-column: 1 / -1; }
}
/* v18 simplification */
.arrowBtn { min-width: 44px; font-size: 20px; line-height: 1; }
.addCard .sectionTitle { margin-bottom: 8px; }
#subSummary { white-space: pre-wrap; }
/* v19 native date picker without overflow */
input[type="date"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.2;
  min-height: 48px;
}
.form { grid-template-columns: minmax(0, 1fr); }
.form label { min-width: 0; overflow: hidden; }

/* v24: clearer settlement cards, text color coverage, safer delete placement */
.personSummaryCards {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 16px;
  color: white;
}
.personSummaryCard {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 18px;
  background: rgba(255,255,255,.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
}
.personName {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 950;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.personStats {
  display: grid;
  gap: 5px;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(255,255,255,.82);
}
.personStats b { color: white; font-size: 14px; }
label,
.settingsCard summary,
.categoryPill,
.expenseMain strong,
.listSummary strong,
.periodBar strong,
.sectionTitle h2 {
  color: var(--ink);
}
.settingsCard summary:after,
.secondary,
.hint,
.categoryPill button,
.deleteBtn,
.originMeta,
.splitLabel,
.splitChip b {
  color: var(--muted);
}
.expenseSide {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-width: 82px;
}
.deleteBtn {
  margin-top: auto;
  align-self: flex-end;
  background: rgba(255,255,255,.86);
}
@media (max-width: 520px) {
  .personSummaryCards { grid-template-columns: 1fr; }
  .expenseSide { min-width: 76px; }
}

/* v25: show paid vs actual burden vs settlement direction */
.personSummaryCard {
  display: grid;
  gap: 8px;
}
.personSettle {
  display: inline-flex;
  width: fit-content;
  align-items: baseline;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.2);
  color: white;
  font-size: 13px;
  font-weight: 950;
}
.personSettle b { font-size: 16px; }
.personSettle.receive { background: rgba(255,255,255,.24); }
.personSettle.pay { background: rgba(255,255,255,.16); }
.personSettle.even { color: rgba(255,255,255,.86); }
.personStats span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

/* v26: visual paid/burden flow inspired by hand sketch */
.settlementVisual {
  position: relative;
  display: grid;
  gap: 12px;
  margin: 12px 0 14px;
  padding: 12px;
  border-radius: 20px;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.18);
}
.flowRow { display: grid; gap: 6px; }
.flowHead,
.flowNames,
.flowAmounts {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.flowHead { align-items: baseline; color: rgba(255,255,255,.82); font-size: 12px; font-weight: 900; }
.flowHead b { color: white; font-size: 13px; }
.flowNames { color: white; font-size: 13px; font-weight: 950; }
.flowAmounts { color: rgba(255,255,255,.88); font-size: 12px; font-weight: 900; }
.flowBar {
  display: flex;
  height: 24px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.18);
}
.flowBar span { display: block; min-width: 8%; transition: width .25s ease; }
.flowA { background: var(--accent); }
.flowB { background: #4c8aef; }
.flowRow.burden .flowA,
.flowRow.burden .flowB { opacity: .68; }

/* v27: compact difference-first settlement visual */
.settlementVisual {
  gap: 8px;
  padding: 14px;
}
.flowTitle {
  display: flex;
  justify-content: space-between;
  color: rgba(255,255,255,.82);
  font-size: 12px;
  font-weight: 950;
}
.flowTitle.bottom { margin-top: -2px; }
.flowMiddle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 0 2px;
  color: white;
  font-size: 13px;
  font-weight: 950;
}
.flowMiddle span:last-child { text-align: right; }
.flowBar {
  position: relative;
  display: flex;
  height: 31px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.16);
}
.flowBurden { opacity: .72; }
.flowSeg {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0 9px;
  color: white;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}
.flowSeg b { overflow: hidden; text-overflow: ellipsis; }
.flowSeg.flowA { justify-content: flex-start; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 72%, white)); }
.flowSeg.flowB { justify-content: flex-end; background: linear-gradient(90deg, #6aa7ff, #4c8aef); }
.flowDiff {
  position: relative;
  height: 28px;
  min-width: 46px;
  transform: translateX(0);
  color: #ff665c;
  border-left: 3px solid currentColor;
  border-right: 3px solid currentColor;
}
.flowDiff:before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  border-top: 3px solid currentColor;
}
.flowDiff:after {
  content: "";
  position: absolute;
  right: 2px;
  top: calc(50% - 5px);
  width: 10px;
  height: 10px;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
  transform: rotate(45deg);
}
.flowDiff span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  color: #d63c34;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}
.personSummaryCards[hidden] { display: none; }

/* v27 fix: amount labels stay readable; diff marker is bidirectional */
.flowBar { isolation: isolate; }
.flowSeg { padding: 0; }
.flowAmt {
  position: absolute;
  z-index: 2;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 12px;
  font-weight: 950;
  text-shadow: 0 1px 8px rgba(0,0,0,.28);
  white-space: nowrap;
}
.flowAmtA { left: 10px; }
.flowAmtB { right: 10px; }
.flowDiff:before {
  left: 6px;
  right: 6px;
}
.flowDiff:after {
  right: 2px;
}
.flowDiff .unused { display: none; }
.flowDiff:has(span):not(.x) { }
.flowDiff::selection { background: transparent; }
.flowDiff:global { }
.flowDiff:before { border-top-width: 3px; }
.flowDiff:after { border-top-width: 3px; border-right-width: 3px; }
.flowDiff {
  border-left-width: 3px;
  border-right-width: 3px;
}
.flowDiff span:before {
  content: "";
  position: absolute;
  left: -16px;
  top: calc(50% - 5px);
  width: 10px;
  height: 10px;
  border-left: 3px solid #ff665c;
  border-bottom: 3px solid #ff665c;
  transform: rotate(45deg);
}

/* v29: no arrow, equal rhythm, person colors on bars */
.settlementVisual {
  display: grid;
  gap: 12px;
  padding: 14px;
}
.flowLine {
  display: grid;
  gap: 6px;
}
.flowTitle {
  margin: 0;
  color: rgba(255,255,255,.82);
  font-size: 12px;
  font-weight: 950;
}
.flowMiddle {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  align-items: center;
  gap: 8px;
  min-height: 31px;
  padding: 0 2px;
  color: white;
  font-size: 13px;
  font-weight: 950;
}
.flowMiddle span:first-child { text-align: left; }
.flowMiddle span:last-child { text-align: right; }
.flowMiddle b {
  justify-self: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
}
.flowSeg.flowA { background: linear-gradient(90deg, var(--personA), color-mix(in srgb, var(--personA) 72%, white)); }
.flowSeg.flowB { background: linear-gradient(90deg, color-mix(in srgb, var(--personB) 72%, white), var(--personB)); }
.flowBurden { opacity: .78; }
.flowDiff { display: none; }

/* v30: PairPay polish, period integrated into settlement, simpler list */
.hero h1 {
  letter-spacing: -.055em;
}
.periodBar { display: none; }
.settlementPeriod {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  margin: -4px 0 18px;
  padding: 10px;
  border-radius: 22px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
}
.settlementPeriod .label { color: rgba(255,255,255,.72); }
.settlementPeriod strong {
  display: block;
  margin-top: 3px;
  color: white;
  font-size: 15px;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settlementPeriod .arrowBtn {
  color: white;
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.2);
  box-shadow: none;
}
.settlementLabel { margin-top: 2px; }
.listSummary {
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.listSummary div:first-child { grid-column: auto; }
.listSummary strong { font-size: 18px; }
.itemActions.simple {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.itemActions.simple button {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  background: rgba(255,255,255,.72);
  color: var(--muted);
  border-color: color-mix(in srgb, var(--line) 70%, transparent);
  box-shadow: none;
}
.itemActions.simple button:first-child {
  color: var(--ink);
  background: rgba(255,255,255,.9);
}
@media (max-width: 520px) {
  .listSummary { grid-template-columns: 1fr 1fr; }
  .listSummary div:first-child { grid-column: auto; }
  .settlementPeriod strong { font-size: 14px; }
}

/* v31: carryover-aware top, simpler month controls, horizontal share buttons */
.settlementPeriod {
  display: inline-grid;
  grid-template-columns: auto auto auto;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: -4px 0 14px;
  padding: 6px;
  background: rgba(255,255,255,.11);
  border-radius: 999px;
}
.settlementPeriod strong {
  min-width: 86px;
  margin: 0;
  align-self: center;
  text-align: center;
  font-size: 15px;
}
.settlementPeriod .arrowBtn {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  font-size: 17px;
  background: rgba(255,255,255,.13);
}
.settlementCard h2 {
  margin-top: 2px;
  font-size: clamp(24px, 7vw, 40px);
}
.shareActions {
  display: grid;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px;
}
.shareActions .ghost {
  min-width: 0;
  padding-left: 8px;
  padding-right: 8px;
  font-size: 13px;
}
.deferMeta {
  background: color-mix(in srgb, var(--accent) 12%, white);
}

/* v32: compact, settlement-target-first expense list */
.expenseItem.compact {
  grid-template-columns: 1fr;
  gap: 0;
  align-items: stretch;
  padding: 12px 13px;
  border-left-width: 6px;
}
.expenseItem.compact .payerBadge,
.expenseItem.compact .expenseSide,
.expenseItem.compact .expenseMeta,
.expenseItem.compact .originMeta,
.expenseItem.compact .deferMeta {
  display: none;
}
.expenseTop {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 10px;
  align-items: start;
}
.titleLine {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}
.titleLine strong {
  font-size: 16px;
  line-height: 1.25;
}
.titleLine time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.payerDot {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--payer-color);
  color: white;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
}
.expenseItem.compact .amount {
  font-size: 18px;
  line-height: 1.2;
  white-space: nowrap;
}
.expenseSub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.settleStatus {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 950;
  line-height: 1.35;
}
.settleStatus b { font-size: 14px; }
.settleStatus.target {
  color: color-mix(in srgb, var(--accent) 70%, var(--ink));
}
.settleStatus.hold {
  color: var(--muted);
}
.settleStatus.done {
  color: var(--muted);
}
.expenseItem.compact.isTarget {
  background: linear-gradient(90deg, color-mix(in srgb, var(--payer-color) 16%, white), rgba(255,250,247,.96) 48%);
}
.expenseItem.compact.notTarget {
  opacity: .82;
  background: rgba(255,255,255,.72);
}
.expenseItem.compact .splitBlock {
  margin-top: 8px;
}
.expenseItem.compact .itemActions.simple {
  margin-top: 10px;
  gap: 6px;
}
.expenseItem.compact .itemActions.simple button {
  padding: 7px 9px;
  font-size: 11px;
}
.expenseItem.compact .itemActions.simple .deleteBtn {
  margin-left: auto;
  color: var(--muted);
  background: rgba(255,255,255,.76);
}
@media (max-width: 520px) {
  .expenseItem.compact { padding: 12px; }
  .titleLine { gap: 6px; }
  .expenseItem.compact .amount { font-size: 17px; }
}

/* v32 fix: split schedule as plain text, no chips */
.scheduleLine {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}
.expenseItem.compact .splitBlock,
.expenseItem.compact .splitChips,
.expenseItem.compact .splitChip { display: none; }

/* v33: one simple paid-vs-burden bar + inline split tag */
.flowOne {
  display: grid;
  gap: 8px;
}
.flowOneHead,
.flowOneFoot {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,.86);
  font-size: 12px;
  font-weight: 900;
}
.flowOneHead span,
.flowOneFoot span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flowOneHead span:last-child,
.flowOneFoot span:last-child { text-align: right; }
.flowOneHead b {
  justify-self: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
}
.flowOneFoot {
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  color: rgba(255,255,255,.74);
  font-size: 11.5px;
}
.flowCompareBar {
  position: relative;
  height: 32px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.26);
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--personA) 26%, white) 0 var(--burden-a),
      color-mix(in srgb, var(--personB) 26%, white) var(--burden-a) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.flowPaidPart {
  position: absolute;
  top: 5px;
  bottom: 5px;
  min-width: 0;
  box-shadow: 0 5px 14px rgba(0,0,0,.10);
}
.flowPaidA {
  left: 5px;
  width: max(0px, calc(var(--paid-a) - 5px));
  border-radius: 999px 4px 4px 999px;
  background: linear-gradient(90deg, var(--personA), color-mix(in srgb, var(--personA) 72%, white));
}
.flowPaidB {
  right: 5px;
  width: max(0px, calc(var(--paid-b) - 5px));
  border-radius: 4px 999px 999px 4px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--personB) 72%, white), var(--personB));
}
.flowBurdenMark {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 2px;
  transform: translateX(-1px);
  border-radius: 99px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 0 0 2px rgba(0,0,0,.08), 0 0 0 5px rgba(255,255,255,.16);
}
.splitTag {
  padding: 3px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--payer-color) 12%, white);
  color: color-mix(in srgb, var(--payer-color) 68%, var(--ink));
  border: 1px solid color-mix(in srgb, var(--payer-color) 22%, transparent);
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}
.expenseItem.compact .expenseSub { display: none; }
@media (max-width: 520px) {
  .flowOneHead { grid-template-columns: 1fr; text-align: center; }
  .flowOneHead span:last-child { text-align: center; }
  .flowOneHead b { order: -1; }
  .flowCompareBar { height: 30px; }
  .splitTag { font-size: 10.5px; }
}

/* v34: settlement answer + compact reason table */
.settleSimple {
  display: grid;
  gap: 10px;
}
.settleAnswer {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 18px;
  background: rgba(255,255,255,.92);
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
}
.settleAnswer span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 950;
}
.settleAnswer b {
  font-size: 22px;
  letter-spacing: -.04em;
  white-space: nowrap;
}
.settleTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(255,255,255,.14);
  color: white;
  font-size: 12px;
  font-weight: 900;
}
.settleTable th,
.settleTable td {
  padding: 9px 7px;
  text-align: right;
  border-bottom: 1px solid rgba(255,255,255,.14);
  white-space: nowrap;
}
.settleTable thead th {
  color: rgba(255,255,255,.72);
  font-size: 11px;
}
.settleTable tbody tr:last-child th,
.settleTable tbody tr:last-child td { border-bottom: 0; }
.settleTable th:first-child {
  max-width: 82px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settleTable td.plus { color: #fff; }
.settleTable td.minus { color: rgba(255,255,255,.78); }
.settleTable td.even { color: rgba(255,255,255,.7); }
@media (max-width: 380px) {
  .settleTable { font-size: 11px; }
  .settleTable th,
  .settleTable td { padding: 8px 5px; }
  .settleAnswer b { font-size: 20px; }
}

/* v35: table-only detail; header alignment fix */
.settleSimple { gap: 0; }
.settleSimple .settleAnswer { display: none; }
.settleTable thead th { text-align: center; }
.settleTable thead th:first-child { text-align: left; }
.settleTable thead th:last-child { text-align: center; }

/* v36: simplify top area, sticky shrinking title, settings on top-right */
.app { padding-top: calc(76px + env(safe-area-inset-top)); }
.hero {
  position: fixed;
  z-index: 40;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: min(760px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--accent) 14%, white 86%);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: padding .18s ease, box-shadow .18s ease, background .18s ease;
}
.hero h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1;
  transition: font-size .18s ease, letter-spacing .18s ease;
}
body.scrolled .hero {
  padding-top: calc(6px + env(safe-area-inset-top));
  padding-bottom: 7px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 10px 26px rgba(92,50,31,.10);
}
body.scrolled .hero h1 { font-size: 21px; letter-spacing: -.045em; }
.settingsCard {
  position: fixed;
  z-index: 60;
  top: calc(9px + env(safe-area-inset-top));
  right: max(12px, calc((100vw - 760px) / 2 + 16px));
  width: auto;
  max-width: min(360px, calc(100vw - 24px));
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.settingsCard summary {
  min-width: 64px;
  padding: 10px 13px;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(92,50,31,.10);
  font-size: 13px;
  text-align: center;
}
.settingsCard summary:after { content: ""; display: none; }
.settingsCard details[open] summary { background: white; }
.settingsCard .settingsBody {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, calc(100vw - 24px));
  max-height: min(74vh, 620px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}
.settlementCard { margin-top: 0; }
.settlementCard:after { display: none; }
.meter { display: none; }
.settlementPeriod {
  grid-template-columns: 44px minmax(0,1fr) 44px !important;
  justify-content: stretch !important;
  width: 100%;
  border-radius: 22px;
}
.settlementPeriod strong { width: 100%; min-width: 0; }
#prevPeriod { justify-self: start; }
#nextPeriod { justify-self: end; }
@media (max-width: 520px) {
  .hero { padding-left: 12px; padding-right: 12px; }
  .settingsCard { right: 12px; }
  .settingsCard .settingsBody { width: calc(100vw - 24px); }
}

/* v37: top add/settings controls + schedule month chips */
.addCard {
  position: fixed;
  z-index: 61;
  top: calc(9px + env(safe-area-inset-top));
  right: max(86px, calc((100vw - 760px) / 2 + 90px));
  width: auto;
  max-width: min(360px, calc(100vw - 24px));
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.addCard summary,
.settingsCard summary {
  display: grid;
  place-items: center;
  height: 42px;
  min-width: 64px;
  padding: 0 13px;
  transition: width .18s ease, min-width .18s ease, padding .18s ease, font-size .18s ease;
}
.addCard summary {
  cursor: pointer;
  list-style: none;
  font-weight: 900;
  font-size: 13px;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(92,50,31,.10);
}
.addCard summary::-webkit-details-marker { display: none; }
.addCard .addBody {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, calc(100vw - 24px));
  max-height: min(74vh, 620px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}
body.scrolled .settingsCard summary,
body.scrolled .addCard summary {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  font-size: 0;
}
body.scrolled .settingsCard summary::before {
  content: "⚙";
  font-size: 18px;
  line-height: 1;
}
body.scrolled .addCard summary::before {
  content: "+";
  font-size: 24px;
  line-height: 1;
}
.scheduleLine {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.scheduleChip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  color: var(--muted);
}
.scheduleChip.current {
  background: color-mix(in srgb, #2f80ed 14%, white);
  border-color: color-mix(in srgb, #2f80ed 34%, transparent);
  color: #2166c2;
}
.scheduleChip.current b { color: #2166c2; }
@media (max-width: 520px) {
  .addCard { right: 84px; }
  .addCard .addBody { width: calc(100vw - 24px); right: -72px; }
}

/* v38: keep top action buttons inside header; add split reset spacing */
.addCard,
.settingsCard {
  top: calc(8px + env(safe-area-inset-top));
}
.addCard summary,
.settingsCard summary {
  height: 36px;
  min-width: 56px;
  padding: 0 11px;
  box-shadow: 0 4px 12px rgba(92,50,31,.08);
}
.settingsCard { right: max(12px, calc((100vw - 760px) / 2 + 16px)); }
.addCard { right: max(78px, calc((100vw - 760px) / 2 + 82px)); }
body.scrolled .settingsCard summary,
body.scrolled .addCard summary {
  width: 34px;
  min-width: 34px;
  height: 34px;
}
body.scrolled .settingsCard summary::before { font-size: 16px; }
body.scrolled .addCard summary::before { font-size: 22px; }
#resetSplitPlan {
  margin-top: 8px;
  background: rgba(255,255,255,.92);
  color: var(--muted);
}
@media (max-width: 520px) {
  .addCard { right: 76px; }
  .settingsCard { right: 12px; }
}

/* v39: move top controls fully above the card; defer month picker */
.app { padding-top: calc(88px + env(safe-area-inset-top)); }
.hero { padding-bottom: 16px; }
.settlementCard { margin-top: 18px; }
.addCard,
.settingsCard { top: calc(10px + env(safe-area-inset-top)); }
.addCard summary,
.settingsCard summary {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  font-size: 0;
}
.addCard summary::before {
  content: "+";
  font-size: 21px;
  line-height: 1;
}
.settingsCard summary::before {
  content: "⚙";
  font-size: 15px;
  line-height: 1;
}
.addCard { right: max(58px, calc((100vw - 760px) / 2 + 58px)); }
.settingsCard { right: max(18px, calc((100vw - 760px) / 2 + 18px)); }
#deferPanel label { margin-top: 8px; }
@media (max-width: 520px) {
  .addCard { right: 58px; }
  .settingsCard { right: 18px; }
}

/* v40: modal item editors, date-grouped list, notes, tighter top icons */
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px 14px;
  background: rgba(255,255,255,.94);
  color: var(--ink);
  outline: none;
  resize: vertical;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
textarea:focus { border-color: rgba(255, 118, 95, .64); box-shadow: 0 0 0 4px rgba(255, 118, 95, .13); }
.addCard,
.settingsCard { top: calc(6px + env(safe-area-inset-top)) !important; }
.addCard summary,
.settingsCard summary {
  box-shadow: none !important;
  border-color: rgba(104,67,50,.10);
}
body.scrolled .addCard,
body.scrolled .settingsCard { top: calc(5px + env(safe-area-inset-top)) !important; }
.dateGroup {
  list-style: none;
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
}
.dateGroup + .dateGroup { margin-top: 14px; }
.dateGroupLabel {
  padding-left: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 950;
}
.dateGroupItems { display: grid; gap: 10px; }
.dateGroup .expenseItem { width: 100%; }
.itemNote {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  white-space: pre-wrap;
}
body.modalOpen { overflow: hidden; }
.editPanel:not([hidden]) {
  position: fixed;
  z-index: 90;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(430px, calc(100vw - 28px));
  max-height: min(82vh, 720px);
  overflow: auto;
  margin: 0;
  padding: 18px;
  border-radius: 26px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 24px 80px rgba(43,33,29,.28);
}
body.modalOpen::after {
  content: "";
  position: fixed;
  z-index: 80;
  inset: 0;
  background: rgba(43,33,29,.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
@media (max-width: 520px) {
  .editPanel:not([hidden]) {
    top: auto;
    bottom: calc(10px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: calc(100vw - 20px);
    max-height: 86vh;
    border-radius: 28px;
  }
}

/* v41: top actions shrink dynamically; prevent iPhone input zoom */
input,
select,
textarea {
  font-size: 16px !important;
}
.addCard,
.settingsCard {
  top: calc(12px + env(safe-area-inset-top)) !important;
}
.addCard summary,
.settingsCard summary {
  width: auto;
  min-width: 54px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  box-shadow: none !important;
  transform-origin: center right;
  transition: width .18s ease, min-width .18s ease, height .18s ease, padding .18s ease, font-size .18s ease, transform .18s ease, background .18s ease;
}
.addCard summary::before,
.settingsCard summary::before {
  content: none;
}
body.scrolled .addCard,
body.scrolled .settingsCard {
  top: calc(7px + env(safe-area-inset-top)) !important;
}
body.scrolled .addCard summary,
body.scrolled .settingsCard summary {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  font-size: 0;
  background: rgba(255,255,255,.9);
}
body.scrolled .addCard summary::before {
  content: "+";
  font-size: 20px;
  line-height: 1;
}
body.scrolled .settingsCard summary::before {
  content: "⚙";
  font-size: 14px;
  line-height: 1;
}
.addCard { right: max(66px, calc((100vw - 760px) / 2 + 66px)); }
.settingsCard { right: max(22px, calc((100vw - 760px) / 2 + 22px)); }
.settlementCard { margin-top: 24px; }
@media (max-width: 520px) {
  .addCard { right: 66px; }
  .settingsCard { right: 22px; }
}

/* v42: iPhone-safe top controls and keyboard-safe modal fields */
.hero {
  min-height: calc(58px + env(safe-area-inset-top));
  overflow: visible;
}
.addCard,
.settingsCard {
  top: calc(18px + env(safe-area-inset-top)) !important;
}
.settingsCard { right: max(16px, calc((100vw - 760px) / 2 + 16px)) !important; }
.addCard { right: max(86px, calc((100vw - 760px) / 2 + 86px)) !important; }
.addCard summary,
.settingsCard summary {
  display: flex !important;
  align-items: center;
  justify-content: center;
  height: 34px !important;
  min-height: 34px;
  border-radius: 999px !important;
  line-height: 1 !important;
  overflow: hidden;
}
.addCard summary {
  min-width: 58px !important;
  padding: 0 12px !important;
  font-size: 12px !important;
}
.settingsCard summary {
  min-width: 58px !important;
  padding: 0 12px !important;
  font-size: 12px !important;
}
.addCard summary::before,
.settingsCard summary::before { content: none !important; }
body.scrolled .addCard,
body.scrolled .settingsCard {
  top: calc(15px + env(safe-area-inset-top)) !important;
}
body.scrolled .settingsCard { right: max(18px, calc((100vw - 760px) / 2 + 18px)) !important; }
body.scrolled .addCard { right: max(62px, calc((100vw - 760px) / 2 + 62px)) !important; }
body.scrolled .addCard summary,
body.scrolled .settingsCard summary {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  padding: 0 !important;
  font-size: 0 !important;
  border-radius: 50% !important;
  aspect-ratio: 1 / 1;
}
body.scrolled .addCard summary::before {
  content: "+" !important;
  display: block;
  font-size: 22px;
  font-weight: 950;
  line-height: 1;
  transform: translateY(-1px);
}
body.scrolled .settingsCard summary::before {
  content: "⚙︎" !important;
  display: block;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-1px);
}
@media (max-width: 520px) {
  .app { padding-top: calc(96px + env(safe-area-inset-top)); }
  .settlementCard { margin-top: 28px; }
  .settingsCard { right: 16px !important; }
  .addCard { right: 86px !important; }
  body.scrolled .settingsCard { right: 18px !important; }
  body.scrolled .addCard { right: 62px !important; }
  .editPanel:not([hidden]) {
    top: calc(70px + env(safe-area-inset-top));
    bottom: auto;
    transform: translateX(-50%);
    max-height: calc(100dvh - 92px - env(safe-area-inset-top));
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }
  .editPanel textarea { min-height: 76px; }
}

/* v43: two kinds of hold + unresolved hold summary */
.holdSummary {
  margin: 12px 0 8px;
  border: 1px solid color-mix(in srgb, #2f80ed 18%, var(--line));
  border-radius: 20px;
  overflow: hidden;
  background: color-mix(in srgb, #2f80ed 7%, white);
}
.holdSummaryHead {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 12px 13px;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}
.holdSummaryHead span { color: #2166c2; font-size: 13px; font-weight: 950; }
.holdSummaryHead b { color: var(--ink); font-size: 18px; letter-spacing: -.03em; }
.holdSummaryHead small { color: var(--muted); font-weight: 900; }
.holdItems {
  display: grid;
  gap: 1px;
  padding: 0 10px 10px;
}
.holdItem {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto auto;
  gap: 7px;
  align-items: center;
  padding: 8px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  border-top: 1px solid rgba(47,128,237,.12);
}
.holdItem b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 13px;
}
.holdItem em { font-style: normal; }
.holdItem strong { color: var(--ink); white-space: nowrap; }
#deferPeriodLabel[hidden] { display: none; }

/* v44: JINS-inspired clean mobile retail UI refresh. Functionality unchanged. */
:root {
  --bg1: #ffffff;
  --bg2: #f7f7f7;
  --card: #ffffff;
  --ink: #111111;
  --muted: #8a8a8a;
  --line: #e9e9e9;
  --accent: #d9122f;
  --accent2: #ff4a5f;
  --accentDark: #d9122f;
  --green: #15935f;
  --shadow: 0 10px 30px rgba(0,0,0,.06);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
}
html { background: #fff; }
body {
  color: var(--ink);
  background: #fff !important;
}
.app {
  width: min(760px, 100%);
  padding: calc(8px + env(safe-area-inset-top)) 14px calc(94px + env(safe-area-inset-bottom));
}
.hero {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 54px;
  padding: 0;
  margin: 0 -14px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid #f0f0f0;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.appBar {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) 42px;
  align-items: center;
  height: 54px;
  padding: 0 10px;
}
.appIcon {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}
.brandLockup { text-align: center; min-width: 0; }
.brandLockup p {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .18em;
}
h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 950;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.card, .settlementCard {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.card { padding: 16px; }
.settlementCard {
  overflow: visible;
  padding: 16px;
  color: var(--ink);
  background: #fff;
}
.settlementCard:after { display: none; }
.settlementPeriod {
  display: grid;
  grid-template-columns: 36px minmax(0,1fr) 36px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.settlementPeriod strong {
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: .02em;
}
.arrowBtn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border-color: #eee;
  background: #fff;
  color: #111;
}
.settlementCard h2 {
  margin: 8px 0 14px;
  color: var(--ink);
  font-size: clamp(23px, 7vw, 34px);
  font-weight: 950;
  line-height: 1.2;
  letter-spacing: -.055em;
  text-align: center;
}
#subSummary {
  margin: 6px 0 14px;
  color: var(--muted);
  text-align: center;
}
.meter { display: none; }
.shareActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.ghost {
  width: 100%;
  border-color: #ececec;
  background: #fff;
  color: #111;
  box-shadow: none;
}
.ghost:active, .secondary:active, .mini:active { transform: scale(.99); }
.settleSimple {
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid #eee;
  border-radius: 14px;
  background: #fafafa;
}
.settleTable { width: 100%; border-collapse: collapse; font-size: 12px; }
.settleTable th, .settleTable td { padding: 10px 8px; border-bottom: 1px solid #ececec; text-align: right; white-space: nowrap; }
.settleTable tr:last-child th, .settleTable tr:last-child td { border-bottom: 0; }
.settleTable th:first-child { text-align: left; color: #111; }
.settleTable thead th { color: var(--muted); font-size: 11px; font-weight: 900; }
.settleTable .plus { color: #15935f; font-weight: 950; }
.settleTable .minus { color: var(--accent); font-weight: 950; }
.settleTable .even { color: var(--muted); font-weight: 900; }
.personSummaryCards { display: none; }
.sectionTitle h2, .listTitle h2 {
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -.03em;
}
label { color: #4b4b4b; font-size: 12px; font-weight: 900; }
input, select, textarea {
  border: 1px solid #e9e9e9;
  border-radius: 12px;
  padding: 13px 12px;
  background: #f7f7f7;
  color: #111;
  box-shadow: none;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
button {
  border: 1px solid #e9e9e9;
  border-radius: 999px;
  padding: 12px 14px;
  background: #fff;
  color: #111;
  font-weight: 950;
  box-shadow: none;
}
.primary {
  border: 0;
  color: #fff;
  background: #000;
  box-shadow: none;
}
.secondary { background: #fff; color: #111; }
.danger, .deleteBtn { color: var(--accent); }
.full { margin-top: 10px; }
.addCard, .settingsCard {
  position: static !important;
  width: auto;
  max-width: none;
  margin-top: 14px;
  padding: 0;
  border: 1px solid #e9e9e9;
  border-radius: 18px;
  background: #fff;
  box-shadow: none;
}
.addCard summary, .settingsCard summary {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0;
  padding: 16px !important;
  border: 0;
  border-radius: 18px !important;
  background: #fff;
  color: #111;
  font-size: 17px !important;
  font-weight: 950;
  text-align: left;
}
.addCard summary::after, .settingsCard summary::after {
  content: "+" !important;
  float: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  padding: 0;
}
.addCard details[open] summary::after, .settingsCard details[open] summary::after { content: "×" !important; background: #111; }
.addCard summary::before, .settingsCard summary::before, body.scrolled .addCard summary::before, body.scrolled .settingsCard summary::before { content: none !important; }
.addCard .addBody, .settingsBody {
  position: static;
  width: auto;
  max-height: none;
  overflow: visible;
  padding: 0 16px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.settingsBody { display: grid; gap: 14px; padding-top: 0; }
.nameGrid { grid-template-columns: 1fr 1fr; gap: 10px; }
.categoryPill {
  background: #f7f7f7;
  color: #111;
  border: 1px solid #ededed;
}
.categoryPill button { background: #fff; color: var(--accent); }
.listSummary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 8px;
}
.listSummary > div {
  padding: 13px;
  border-radius: 14px;
  background: #f7f7f7;
}
.label.dark { color: var(--muted); }
.listSummary strong { display: block; margin-top: 4px; font-size: 20px; letter-spacing: -.04em; }
.miniSelect { border-radius: 999px; background: #f7f7f7; padding: 9px 32px 9px 12px; font-size: 13px !important; }
.dateGroupLabel {
  padding: 12px 2px 0;
  color: #111;
  font-size: 13px;
  font-weight: 950;
}
.dateGroupItems { gap: 8px; }
.expenseItem, .expenseItem.compact {
  grid-template-columns: 1fr;
  padding: 13px;
  border: 1px solid #ededed;
  border-left: 0;
  border-radius: 16px;
  background: #fff !important;
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.expenseItem.notTarget { opacity: .72; }
.expenseTop { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: start; }
.titleLine { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.titleLine strong { margin: 0; font-size: 16px; font-weight: 950; }
.amount { color: #111; font-size: 18px; font-weight: 950; }
.payerDot, .splitTag, .settleStatus, .deferMeta, .scheduleChip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
}
.payerDot {
  padding: 5px 7px;
  background: var(--payer-color);
  color: #fff;
}
.splitTag { padding: 5px 7px; background: #f2f2f2; color: #555; }
.itemNote { color: #676767; font-size: 12px; }
.settleStatus { margin-top: 8px; padding: 7px 9px; background: #fff4f5; color: var(--accent); }
.settleStatus.target { background: #f0f7ff; color: #2166c2; }
.settleStatus.hold { background: #fff7e8; color: #9b6400; }
.itemActions.simple {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 6px;
  margin-top: 10px;
}
.itemActions.simple button {
  padding: 9px 4px;
  border-radius: 999px;
  background: #f8f8f8;
  font-size: 12px;
}
.itemActions.simple .deleteBtn { margin-top: 0; background: #fff4f5; }
.empty {
  border: 1px dashed #dedede;
  border-radius: 16px;
  background: #fafafa;
}
.holdSummary {
  border: 1px solid #ffd7dc;
  border-radius: 16px;
  background: #fff7f8;
}
.holdSummaryHead span { color: var(--accent); }
.holdItem { border-top-color: #ffe1e5; }
.editPanel:not([hidden]) {
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0,0,0,.24);
}
body.modalOpen::after { background: rgba(0,0,0,.34); }
.splitRow {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto;
  gap: 8px;
  align-items: center;
}
.toast {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: calc(82px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,.86);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}
.bottomNav {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(430px, calc(100vw - 20px));
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid #e9e9e9;
  border-radius: 28px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 14px 40px rgba(0,0,0,.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.bottomNav button {
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 4px 2px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: #999;
}
.bottomNav button span { font-size: 20px; line-height: 1; }
.bottomNav button small { font-size: 10px; font-weight: 950; }
.bottomNav button.isActive { color: var(--accent); background: #fff4f5; }
@media (max-width: 520px) {
  .app { padding-left: 12px; padding-right: 12px; }
  .hero { margin-left: -12px; margin-right: -12px; }
  .card, .settlementCard { border-radius: 16px; }
  .card { padding: 14px; }
  .nameGrid { grid-template-columns: 1fr; }
  .shareActions { grid-template-columns: 1fr 1fr; }
  .itemActions.simple { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .editPanel:not([hidden]) {
    top: auto;
    bottom: calc(82px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 120px - env(safe-area-inset-top));
    border-radius: 22px;
  }
  .splitRow { grid-template-columns: 1fr; }
  .splitRow .danger { width: 100%; }
}

/* v44.1: prevent mobile horizontal drift from long Japanese labels. */
html, body { max-width: 100%; overflow-x: hidden; }
.app, .hero, .settlementCard, .card, .bottomNav { max-width: 100%; }
.settlementCard h2, .titleLine strong, .brandLockup h1, .brandLockup p, button, .ghost { overflow-wrap: anywhere; word-break: keep-all; }
.shareActions > button { min-width: 0; }
.ghost { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* v44.2: reset older fixed hero positioning. */
.hero {
  left: auto !important;
  right: auto !important;
  top: 0 !important;
  transform: none !important;
  width: auto !important;
  display: block !important;
  justify-content: initial !important;
  align-items: initial !important;
  box-shadow: none !important;
}
body.scrolled .hero {
  padding: 0 !important;
  background: rgba(255,255,255,.96) !important;
  box-shadow: none !important;
}
body.scrolled .hero h1 { font-size: 15px !important; letter-spacing: -.02em !important; }

/* v44.3: keep both app-bar arrows visible. */
.appBar { width: 100%; box-sizing: border-box; overflow: hidden; }
.brandLockup { overflow: hidden; }
.appIcon:first-child { justify-self: start; }
.appIcon:last-child { justify-self: end; }

/* v44.4: render right period arrow consistently. */
.appIcon:last-child { font-size: 0; }
.appIcon:last-child::before { content: "›"; font-size: 28px; font-weight: 400; line-height: 1; color: #111; }

/* v44.5: restore contrast after older high-specificity rules. */
.hero .brandLockup h1 {
  margin: 0 !important;
  color: #111 !important;
  font-size: 16px !important;
  line-height: 1.05 !important;
  letter-spacing: -.03em !important;
}
.hero .brandLockup p { color: var(--accent) !important; }
.settlementCard .settlementPeriod {
  background: #f8f8f8 !important;
  border: 1px solid #eeeeee !important;
  border-radius: 999px !important;
  padding: 6px !important;
}
.settlementCard .settlementPeriod strong { color: #111 !important; }
.settlementCard .settlementPeriod .arrowBtn {
  color: #111 !important;
  background: #fff !important;
  border-color: #eeeeee !important;
}

/* v44.6: keep both month arrows inside the period pill. */
.settlementCard .settlementPeriod {
  display: grid !important;
  grid-template-columns: 42px minmax(0,1fr) 42px !important;
  align-items: center !important;
  gap: 6px !important;
  width: 100% !important;
  justify-content: stretch !important;
  overflow: hidden !important;
}
.settlementCard .settlementPeriod .arrowBtn {
  min-width: 36px !important;
  width: 36px !important;
  height: 36px !important;
  justify-self: center !important;
}

/* v44.7: bulletproof period arrows. */
.settlementCard .settlementPeriod { position: relative !important; padding-left: 48px !important; padding-right: 48px !important; }
#prevPeriod, #nextPeriod { position: absolute !important; top: 50% !important; transform: translateY(-50%) !important; }
#prevPeriod { left: 7px !important; }
#nextPeriod { right: 7px !important; }

/* v44.8: simple period pill layout. */
.settlementCard .settlementPeriod {
  display: block !important;
  min-height: 48px !important;
  padding: 6px 52px !important;
}
.settlementCard .settlementPeriod > div { display: grid !important; place-items: center !important; min-height: 36px !important; min-width: 0 !important; }
.settlementCard .settlementPeriod strong { width: 100% !important; min-width: 0 !important; text-align: center !important; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }

/* v44.9: inset right month arrow for narrow Safari/headless layouts. */
#nextPeriod { right: 38px !important; }

/* v45: dedicated bottom-nav pages + rename cleanup + contrast fixes. */
.app { padding-bottom: calc(132px + env(safe-area-inset-bottom)) !important; }
.appBar {
  grid-template-columns: minmax(0, 1fr) !important;
  justify-items: center;
  height: 58px !important;
}
.appIcon, .appIcon::before { display: none !important; }
.hero .brandLockup h1 { font-size: 15px !important; }
.hero .brandLockup p { color: var(--accent) !important; opacity: 1 !important; }
.addCard, .settingsCard, .listCard, .settlementCard, .copyPanel { display: none !important; }
body.page-home .settlementCard,
body.page-home .copyPanel:not([hidden]),
body.page-add .addCard,
body.page-list .listCard,
body.page-settings .settingsCard { display: block !important; }
body.page-add .addCard,
body.page-settings .settingsCard,
body.page-list .listCard { margin-top: 18px; }
body.page-add .addCard summary,
body.page-settings .settingsCard summary { display: none !important; }
body.page-add .addCard .addBody,
body.page-settings .settingsBody {
  display: grid !important;
  gap: 14px;
  padding: 16px !important;
}
body.page-add .addCard,
body.page-settings .settingsCard {
  border-radius: 20px;
  min-height: calc(100dvh - 210px);
}
body.page-list .listCard {
  margin-bottom: calc(120px + env(safe-area-inset-bottom));
}
.settlementCard .settlementVisual,
.settlementCard .settleSimple,
.settlementCard .settleTable,
.settlementCard .settleTable th,
.settlementCard .settleTable td {
  color: #111 !important;
  background: transparent;
}
.settlementCard .settleTable thead th { color: #666 !important; }
.settlementCard .settleTable td.plus { color: #15935f !important; }
.settlementCard .settleTable td.minus { color: #d9122f !important; }
.settlementCard .settleTable td.even { color: #777 !important; }
.settlementCard .settleSimple { background: #fafafa !important; }
.settlementCard h2 { color: #111 !important; }
.bottomNav {
  bottom: calc(16px + env(safe-area-inset-bottom)) !important;
  z-index: 110 !important;
}
body.page-add .bottomNav button[data-bottom-action="add"],
body.page-settings .bottomNav button[data-bottom-action="settings"],
body.page-list .bottomNav button[data-bottom-action="list"],
body.page-home .bottomNav button[data-bottom-action="home"] {
  color: var(--accent);
  background: #fff4f5;
}
@media (max-width: 520px) {
  .app { padding-bottom: calc(150px + env(safe-area-inset-bottom)) !important; }
  .bottomNav { width: min(430px, calc(100vw - 28px)); }
}

/* v45.3: override old floating panel CSS on dedicated pages. */
body.page-add .addCard,
body.page-settings .settingsCard,
body.page-list .listCard {
  position: static !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden;
}
body.page-add .addCard .addBody,
body.page-settings .settingsCard .settingsBody {
  position: static !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  overflow: visible !important;
  box-shadow: none !important;
  border: 0 !important;
  background: transparent !important;
}
.form, label, input, select, textarea { min-width: 0; }
body.page-add .addCard details,
body.page-settings .settingsCard details { display: block; width: 100%; }

/* v45.4: keep form controls away from the viewport edge on iPhone. */
body.page-add .addCard .addBody,
body.page-settings .settingsCard .settingsBody { width: auto !important; }
body.page-add input,
body.page-add select,
body.page-add textarea,
body.page-settings input,
body.page-settings select,
body.page-settings textarea { max-width: 100% !important; }

/* v45.5: compensate for mobile date/select intrinsic width. */
body.page-add .addCard .addBody,
body.page-settings .settingsCard .settingsBody {
  box-sizing: border-box !important;
  padding-right: 30px !important;
}

/* v46: requested refinements. */
.settlementCard h2 { white-space: normal !important; }
.homeHoldSummary { display: none !important; }
body.page-home .homeHoldSummary:not([hidden]) { display: block !important; }
.homeHoldSummary .sectionTitle { margin-bottom: 8px; }
.holdSummaryHead.static {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 0;
  color: #111;
}
.homeHoldHint { margin: 8px 0 0; color: #666; font-size: 13px; font-weight: 800; }
.listPeriodNav {
  display: grid;
  grid-template-columns: 40px minmax(0,1fr) 40px;
  align-items: center;
  gap: 8px;
  margin: 6px 0 12px;
  padding: 6px;
  border: 1px solid #eee;
  border-radius: 999px;
  background: #f8f8f8;
}
.listPeriodNav strong { text-align: center; font-size: 14px; font-weight: 950; }
.listTabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 12px;
  padding: 5px;
  border-radius: 999px;
  background: #f7f7f7;
}
.listTabs button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #777;
  padding: 10px 8px;
  font-size: 13px;
}
.listTabs button.isActive { background: #fff; color: var(--accent); box-shadow: 0 1px 8px rgba(0,0,0,.06); }
.editGrid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.editPanel:not([hidden]) .form { gap: 10px; }
.editPanel:not([hidden]) label { gap: 5px; }
.editPanel:not([hidden]) input,
.editPanel:not([hidden]) select,
.editPanel:not([hidden]) textarea { padding: 11px 10px; }
.editPanel:not([hidden]) .sectionTitle { margin-bottom: 8px; }
.editPanel:not([hidden]) textarea { min-height: 58px !important; }
button::before, button::after { content: none; }
.addCard summary::after, .settingsCard summary::after { content: none !important; }
.categoryPill button::before, .categoryPill button::after { content: none !important; }
@media (max-width: 380px) {
  .editGrid.two { grid-template-columns: 1fr; }
}

/* v46.1: list controls must never overflow on iPhone Safari. */
.listCard { overflow: hidden !important; }
.listTitle {
  display: grid !important;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center !important;
  gap: 10px;
}
.listTitle .actions { min-width: 0; max-width: 112px; }
.listTitle .miniSelect { max-width: 112px; min-width: 0; }
.listPeriodNav {
  grid-template-columns: 36px minmax(0,1fr) 36px !important;
  overflow: hidden;
}
.listPeriodNav .arrowBtn {
  min-width: 32px !important;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  justify-self: center;
}
#listPrevPeriod, #listNextPeriod {
  position: static !important;
  transform: none !important;
  left: auto !important;
  right: auto !important;
}
.listTabs button { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* v46.2: hard stop all horizontal overflow that clipped right-side controls. */
.app {
  width: 100% !important;
  max-width: 760px !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}
.card, .settlementCard, .listCard, .listSummary, .listPeriodNav, .listTabs {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
.listCard * { box-sizing: border-box; }
#listNextPeriod, #listPrevPeriod { color: #111 !important; background: #fff !important; }

/* v46.3: draw list next arrow as an internal control so it cannot be clipped. */
.listPeriodNav { position: relative !important; padding-right: 46px !important; padding-left: 46px !important; display: block !important; min-height: 46px; }
.listPeriodNav strong { display: grid; place-items: center; min-height: 34px; }
#listPrevPeriod, #listNextPeriod { position: absolute !important; top: 6px !important; width: 34px !important; height: 34px !important; transform: none !important; z-index: 1; }
#listPrevPeriod { left: 6px !important; }
#listNextPeriod { right: 6px !important; }

/* v46.4: visual fallback for the list next arrow and safer filter placement. */
.listPeriodNav::after {
  content: "→";
  position: absolute;
  right: 6px;
  top: 6px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #eee;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-size: 20px;
  font-weight: 950;
  pointer-events: none;
}
.listTitle .actions { transform: translateX(-8px); }

/* v47: remove stray center arrow and add subscription-app-inspired insight card. */
.listPeriodNav::after { content: none !important; display: none !important; }
#listPeriodTitle { letter-spacing: .01em; }
.homeInsight { display: none !important; }
body.page-home .homeInsight:not([hidden]) { display: block !important; }
.insightHero {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #effbfa, #ffffff 58%, #f8fffe);
  border: 1px solid #d8f0ee;
}
.insightHero p {
  margin: 0 0 7px;
  color: #0f8d8a;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .16em;
}
.insightHero h2 {
  margin: 0;
  color: #111;
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -.05em;
}
.insightHero span {
  display: block;
  margin-top: 8px;
  color: #5f6f6e;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.6;
}
.insightMiniGrid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 8px;
  margin-top: 10px;
}
.insightMiniGrid div {
  padding: 12px 10px;
  border-radius: 15px;
  background: #f7f7f7;
}
.insightMiniGrid small {
  display: block;
  color: #7a7a7a;
  font-size: 11px;
  font-weight: 950;
}
.insightMiniGrid b {
  display: block;
  margin-top: 5px;
  color: #111;
  font-size: 16px;
  font-weight: 950;
  letter-spacing: -.04em;
}

/* v47: remove stray center arrow and add subscription-app-inspired insight card. */
.listPeriodNav::after { content: none !important; display: none !important; }
#listPeriodTitle { letter-spacing: .01em; }
.homeInsight { display: none !important; }
body.page-home .homeInsight:not([hidden]) { display: block !important; }
.insightHero {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #effbfa, #ffffff 58%, #f8fffe);
  border: 1px solid #d8f0ee;
}
.insightHero p {
  margin: 0 0 7px;
  color: #0f8d8a;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .16em;
}
.insightHero h2 {
  margin: 0;
  color: #111;
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -.05em;
}
.insightHero span {
  display: block;
  margin-top: 8px;
  color: #5f6f6e;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.6;
}
.insightMiniGrid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 8px;
  margin-top: 10px;
}
.insightMiniGrid div {
  padding: 12px 10px;
  border-radius: 15px;
  background: #f7f7f7;
}
.insightMiniGrid small {
  display: block;
  color: #7a7a7a;
  font-size: 11px;
  font-weight: 950;
}
.insightMiniGrid b {
  display: block;
  margin-top: 5px;
  color: #111;
  font-size: 16px;
  font-weight: 950;
  letter-spacing: -.04em;
}

/* v47.1: replace fragile circular list arrows with clear month buttons. */
body.page-list .listPeriodNav .arrowBtn { display: none !important; }
body.page-list .listPeriodNav {
  padding: 10px 14px !important;
  min-height: 0 !important;
  border-radius: 16px !important;
  display: grid !important;
  place-items: center !important;
}
.listMonthButtons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: -4px 0 12px;
}
.listMonthButtons button {
  border-radius: 999px;
  background: #fff;
  color: #111;
  border: 1px solid #e9e9e9;
  padding: 10px 12px;
  font-size: 13px;
}

/* v47.2: iPhone Safari-safe one-column list controls. */
.listTitle { grid-template-columns: 1fr !important; }
.listTitle .actions { max-width: 100% !important; transform: none !important; justify-self: stretch; }
.listTitle .miniSelect { width: 100% !important; max-width: 100% !important; }
.listMonthButtons { grid-template-columns: 1fr !important; }
.listMonthButtons button { width: 100%; }

/* v47.3: avoid clipped two-column summary on narrow Safari. */
body.page-list .listSummary { grid-template-columns: 1fr !important; }

/* v48: life-app concept entry */
.conceptCard {
  margin: 10px 0 0;
  padding: 14px 16px;
  border: 1px solid #eeeeee;
  border-radius: 18px;
  background: #fff;
  color: #111;
}
.conceptCard p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}
.conceptCard strong {
  display: block;
  font-size: 17px;
  font-weight: 950;
  letter-spacing: -.03em;
}
.settlementCard h2 small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
}
@media (max-width: 520px) {
  .conceptCard { margin-left: 0; margin-right: 0; }
  .conceptCard strong { font-size: 16px; }
}

/* v49: compact sharing setup, no separate concept card. */
.shareSetup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid #eeeeee;
  border-radius: 16px;
  background: #fafafa;
}
.shareSetup b {
  display: block;
  color: #111;
  font-size: 14px;
  font-weight: 950;
}
.shareSetup p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}
.shareSetup button {
  flex: 0 0 auto;
  padding-inline: 14px;
}
@media (max-width: 420px) {
  .shareSetup { align-items: stretch; flex-direction: column; }
  .shareSetup button { width: 100%; }
}

/* v50: remove noisy concept cards, stabilize list controls, and fix oversized dark toast. */
.toast {
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: calc(86px + env(safe-area-inset-bottom)) !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: calc(100vw - 44px) !important;
  max-height: 48px !important;
  padding: 10px 14px !important;
  border: 1px solid #e9e9e9 !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.98) !important;
  color: #111 !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.12) !important;
  font-size: 13px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.homeInsight { display: none !important; }

body.page-list .listCard {
  padding-top: 14px !important;
}
body.page-list .listTitle {
  display: grid !important;
  grid-template-columns: minmax(0,1fr) auto !important;
  align-items: center !important;
  gap: 10px !important;
  margin-bottom: 8px !important;
}
body.page-list .listTitle h2 {
  min-width: 0 !important;
  font-size: 18px !important;
  line-height: 1.2 !important;
}
body.page-list .listTitle .actions {
  justify-self: end !important;
  width: auto !important;
  max-width: 132px !important;
  transform: none !important;
}
body.page-list .listTitle .miniSelect {
  width: 132px !important;
  max-width: 132px !important;
  height: 36px !important;
  padding: 7px 28px 7px 11px !important;
  font-size: 12px !important;
}
body.page-list .listPeriodNav {
  position: sticky !important;
  top: calc(56px + env(safe-area-inset-top)) !important;
  z-index: 35 !important;
  display: grid !important;
  grid-template-columns: 34px minmax(0,1fr) 34px !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 42px !important;
  margin: 4px 0 8px !important;
  padding: 4px 8px !important;
  border: 1px solid #eeeeee !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.96) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}
body.page-list .listPeriodNav .arrowBtn,
body.page-list #listPrevPeriod,
body.page-list #listNextPeriod {
  display: grid !important;
  position: static !important;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  place-items: center !important;
  transform: none !important;
}
body.page-list #listPeriodTitle {
  display: block !important;
  min-height: 0 !important;
  text-align: center !important;
  font-size: 14px !important;
  font-weight: 950 !important;
  letter-spacing: .01em !important;
}
body.page-list .listMonthButtons { display: none !important; }
body.page-list .listTabs {
  margin-top: 8px !important;
}
body.page-list .listSummary {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
  margin: 8px 0 8px !important;
}
body.page-list .listSummary > div {
  padding: 10px 12px !important;
  border-radius: 13px !important;
}
body.page-list .listSummary .label {
  font-size: 10px !important;
  line-height: 1.1 !important;
}
body.page-list .listSummary strong {
  margin-top: 3px !important;
  font-size: 16px !important;
  line-height: 1.15 !important;
}
body.page-list .dateGroupLabel {
  position: sticky !important;
  top: calc(104px + env(safe-area-inset-top)) !important;
  z-index: 30 !important;
  margin: 0 0 6px !important;
  padding: 7px 10px !important;
  border: 1px solid #eeeeee !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.96) !important;
  color: #111 !important;
  font-size: 12px !important;
  line-height: 1 !important;
  width: fit-content !important;
  box-shadow: 0 6px 16px rgba(0,0,0,.06) !important;
}

/* v51: clearer list filter, spacing, and stronger sticky month bar. */
body.page-list .listTitle .actions {
  position: relative !important;
  max-width: 150px !important;
}
body.page-list .listTitle .actions::before {
  content: "≡▾";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-52%);
  z-index: 1;
  color: #777;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: -.08em;
  pointer-events: none;
}
body.page-list .listTitle .miniSelect {
  width: 150px !important;
  max-width: 150px !important;
  padding-left: 34px !important;
}
body.page-list .listPeriodNav {
  position: -webkit-sticky !important;
  position: sticky !important;
  top: calc(54px + env(safe-area-inset-top)) !important;
  z-index: 80 !important;
  margin: 8px 0 16px !important;
  box-shadow: 0 8px 22px rgba(0,0,0,.08) !important;
}
body.page-list .listTabs {
  margin-top: 0 !important;
  margin-bottom: 12px !important;
}
body.page-list .listCard {
  overflow: visible !important;
}
body.page-list .expenseList,
body.page-list .dateGroup,
body.page-list .dateGroupItems {
  overflow: visible !important;
}

/* v52: fixed month bar on list page and settlement completion states. */
body.page-list .listCard { padding-top: 58px !important; }
body.page-list .listPeriodNav {
  position: fixed !important;
  top: calc(56px + env(safe-area-inset-top)) !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: min(430px, calc(100vw - 32px)) !important;
  z-index: 130 !important;
  margin: 0 !important;
}
.shareActions {
  grid-template-columns: 1fr 1fr 1fr !important;
}
#completePeriod[hidden] { display: none !important; }
#completePeriod {
  background: #111 !important;
  color: #fff !important;
  border-color: #111 !important;
  box-shadow: none !important;
}
.settleStatus.done {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #eef8f1;
  color: #16844d;
  font-size: 12px;
  font-weight: 950;
}
.expenseItem.isDone {
  opacity: .72;
  background: #fafafa !important;
}
.expenseItem.isDone .amount,
.expenseItem.isDone .titleLine strong {
  color: #777 !important;
}
@media (max-width: 420px) {
  .shareActions { gap: 8px !important; }
  .shareActions button { padding-inline: 8px !important; font-size: 12px !important; }
}

/* v53: lock completed settlement items, allow explicit reopen only. */
.reopenBtn {
  width: 100%;
  border-color: #dfe8ff !important;
  background: #f5f8ff !important;
  color: #2456b3 !important;
}
.expenseItem.isDone .itemActions button:not(.reopenBtn) {
  display: none !important;
}
.expenseItem.isDone .splitTag {
  opacity: .7;
}

/* v56: make completed-item reopen unmistakably tappable on iPhone Safari. */
.reopenBtn {
  position: relative !important;
  z-index: 5 !important;
  display: block !important;
  min-height: 44px !important;
  pointer-events: auto !important;
  touch-action: manipulation !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}
.reopenHint {
  display: block;
  margin-top: 6px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}
.expenseItem.isDone .itemActions {
  position: relative !important;
  z-index: 4 !important;
}


/* v57: confirmation state, locked split rows, and explicit memo label. */
.reopenBtn[data-confirm-reopen="1"] {
  background: #fff7ed !important;
  border-color: #fdba74 !important;
  color: #9a3412 !important;
}
.splitRow.locked {
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto;
  opacity: .78;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 8px;
}
.splitRow.locked select,
.splitRow.locked input {
  color: #6b7280 !important;
  background: #f3f4f6 !important;
  -webkit-text-fill-color: #6b7280;
}
.splitLockedBadge {
  align-self: center;
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #15803d;
  font-size: 11px;
  font-weight: 950;
}
.itemNote {
  display: flex !important;
  align-items: flex-start;
  gap: 6px;
}
.itemNote span {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 10px;
  font-weight: 950;
  line-height: 1.35;
}
@media (max-width: 420px) {
  .splitRow.locked { grid-template-columns: 1fr; }
  .splitLockedBadge { width: fit-content; }
}


/* v58: lock total amount after any paid/completed split and fix only date headers, not month selector. */
.lockedInput,
input.lockedInput:disabled {
  color: #6b7280 !important;
  background: #f3f4f6 !important;
  -webkit-text-fill-color: #6b7280;
  opacity: 1 !important;
}
.lockedEditHint {
  display: block;
  margin-top: 4px;
  color: #15803d;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.35;
}
body.page-list .listCard {
  padding-top: 14px !important;
}
body.page-list .listPeriodNav {
  position: static !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  width: 100% !important;
  z-index: 2 !important;
  margin: 8px 0 12px !important;
}
body.page-list .dateGroupLabel {
  position: -webkit-sticky !important;
  position: sticky !important;
  top: calc(8px + env(safe-area-inset-top)) !important;
  z-index: 130 !important;
}

/* v59: keep sticky date labels in the list only, never above modals; fix reopen confirmation button width. */
body.modalOpen .dateGroupLabel {
  z-index: 1 !important;
  visibility: hidden !important;
}
body.modalOpen .editPanel:not([hidden]) {
  z-index: 260 !important;
}
body.modalOpen::after {
  z-index: 240 !important;
}
body.modalOpen .bottomNav {
  z-index: 70 !important;
}
.expenseItem.isDone .itemActions.simple {
  grid-template-columns: minmax(108px, auto) minmax(0, 1fr) !important;
  align-items: center !important;
}
.expenseItem.isDone .reopenBtn {
  width: auto !important;
  min-width: 108px !important;
  max-width: 150px !important;
  padding: 10px 12px !important;
  white-space: normal !important;
  line-height: 1.2 !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
}
.expenseItem.isDone .reopenHint {
  margin-top: 0 !important;
  min-width: 0 !important;
}
@media (max-width: 380px) {
  .expenseItem.isDone .itemActions.simple {
    grid-template-columns: minmax(120px, auto) minmax(0, 1fr) !important;
  }
  .expenseItem.isDone .reopenBtn {
    min-width: 120px !important;
  }
}

/* v61: pin the list date chip around the blue-line position after the header block scrolls past. */
body.page-list .dateGroupLabel {
  top: calc(clamp(310px, 38vh, 420px) + env(safe-area-inset-top)) !important;
  z-index: 120 !important;
  width: fit-content !important;
  margin-left: 0 !important;
  background: rgba(255,255,255,.98) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}

/* v62: JS-controlled date chip pinning. CSS sticky was too imprecise for the requested threshold. */
body.page-list .dateGroupLabel {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
}
body.page-list .dateGroupLabel.isPinnedDate {
  position: fixed !important;
  left: var(--pinned-date-left, 24px) !important;
  top: var(--pinned-date-top, 430px) !important;
  z-index: 135 !important;
  margin: 0 !important;
  pointer-events: none !important;
  background: rgba(255,255,255,.98) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}
body.page-list .dateGroupLabel.isPinnedDateSpacer {
  visibility: hidden !important;
}
body.modalOpen .dateGroupLabel.isPinnedDate {
  display: none !important;
}

/* v63: keep the pinned date chip on the requested blue-line position, and
   make list actions read as active buttons instead of disabled grey pills. */
body.page-list .dateGroupLabel.isPinnedDate {
  top: var(--pinned-date-top, calc(clamp(210px, 26vh, 300px) + env(safe-area-inset-top))) !important;
}
.itemActions.simple button[data-edit],
.expenseItem.compact .itemActions.simple button[data-edit] {
  color: #111 !important;
  background: #fff !important;
  border-color: #dcdcdc !important;
}
.itemActions.simple button[data-partial],
.expenseItem.compact .itemActions.simple button[data-partial] {
  color: #1559b7 !important;
  background: #eef6ff !important;
  border-color: #bfdbfe !important;
}
.itemActions.simple button[data-defer],
.expenseItem.compact .itemActions.simple button[data-defer] {
  color: #9a5a00 !important;
  background: #fff7e6 !important;
  border-color: #fde3aa !important;
}
.itemActions.simple button[data-partial]:active,
.itemActions.simple button[data-defer]:active {
  filter: brightness(.98);
  transform: scale(.99);
}

/* v64: clearer settings groups, slider ratio control, and reliable pinned date chip. */
.settingsSection {
  display: grid;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
  padding: 14px;
  border: 1px solid #eeeeee;
  border-radius: 16px;
  background: #fafafa;
}
.settingsSection h3 {
  margin: 0;
  color: #111;
  font-size: 14px;
  font-weight: 950;
  letter-spacing: -.02em;
}
.settingsSection .shareSetup { background: #fff; }
.settingsSection label,
.settingsSection input,
.settingsSection select,
.settingsSection button,
.settingsSection .shareSetup,
.settingsSection .nameGrid { min-width: 0; }
body.page-settings .app { padding-bottom: calc(118px + env(safe-area-inset-bottom)) !important; }
.dangerSection { background: #fffafa; border-color: #ffe1e5; }
.ratioSetting { gap: 10px; }
.ratioHeader {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #111;
  font-size: 12px;
  font-weight: 950;
}
#customSplitA[type="range"] {
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}
#customSplitA[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--personA), var(--personB));
}
#customSplitA[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -9px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #111;
  box-shadow: 0 4px 14px rgba(0,0,0,.24);
}
#customSplitA[type="range"]::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--personA), var(--personB));
}
#customSplitA[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #111;
  box-shadow: 0 4px 14px rgba(0,0,0,.24);
}
body.page-list .dateGroupLabel.isPinnedDate {
  display: inline-flex !important;
  visibility: visible !important;
  align-items: center !important;
}

/* v66: disable date-chip pinning for now, and center form field text consistently. */
input,
select,
textarea {
  text-align: center !important;
}
input::placeholder,
textarea::placeholder {
  text-align: center !important;
}
select option {
  text-align: center;
}

/* v67: force every editable field to center text both horizontally and vertically. */
input:not([type="range"]):not([type="color"]),
select {
  height: 60px !important;
  min-height: 60px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  padding-left: 12px !important;
  padding-right: 12px !important;
  line-height: 60px !important;
  text-align: center !important;
  text-align-last: center !important;
}
input:not([type="range"]):not([type="color"])::placeholder {
  line-height: 60px !important;
  text-align: center !important;
}
input::-webkit-date-and-time-value {
  display: block;
  width: 100%;
  min-height: 60px;
  line-height: 60px;
  text-align: center;
}
textarea:not(#copyText) {
  min-height: 82px !important;
  padding: 0 12px !important;
  line-height: 82px !important;
  text-align: center !important;
}
textarea:not(#copyText)::placeholder {
  line-height: 82px !important;
  text-align: center !important;
}
.editPanel:not([hidden]) input:not([type="range"]):not([type="color"]),
.editPanel:not([hidden]) select {
  height: 60px !important;
  min-height: 60px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: 60px !important;
  text-align: center !important;
  text-align-last: center !important;
}
.editPanel:not([hidden]) textarea:not(#copyText) {
  min-height: 82px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: 82px !important;
}

/* v68: compact controls, stable edit lock badge, and smaller list filter. */
input:not([type="range"]):not([type="color"]),
select {
  height: 52px !important;
  min-height: 52px !important;
  line-height: 52px !important;
}
input:not([type="range"]):not([type="color"])::placeholder,
input::-webkit-date-and-time-value {
  min-height: 52px !important;
  line-height: 52px !important;
}
textarea:not(#copyText) {
  min-height: 66px !important;
  line-height: 66px !important;
}
textarea:not(#copyText)::placeholder {
  line-height: 66px !important;
}
.editPanel:not([hidden]) input:not([type="range"]):not([type="color"]),
.editPanel:not([hidden]) select {
  height: 52px !important;
  min-height: 52px !important;
  line-height: 52px !important;
}
.editPanel:not([hidden]) textarea:not(#copyText) {
  min-height: 66px !important;
  line-height: 66px !important;
}
.editPanel:not([hidden]) label { position: relative; }
.lockedEditHint {
  position: absolute !important;
  left: 44px !important;
  right: auto !important;
  top: 0 !important;
  bottom: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  width: auto !important;
  margin: 0 !important;
  padding: 3px 7px !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: #16844d !important;
  font-size: 10px !important;
  font-weight: 950 !important;
  line-height: 1 !important;
  pointer-events: none !important;
  white-space: nowrap !important;
}
body.page-list .listTitle {
  grid-template-columns: minmax(0,1fr) auto !important;
  gap: 8px !important;
}
body.page-list .listTitle .actions {
  width: 104px !important;
  max-width: 104px !important;
  justify-self: end !important;
}
body.page-list .listTitle .actions::before {
  left: 9px !important;
  font-size: 10px !important;
}
body.page-list .listTitle .miniSelect {
  width: 104px !important;
  max-width: 104px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 18px 0 26px !important;
  line-height: 38px !important;
  font-size: 12px !important;
  text-align: center !important;
  text-align-last: center !important;
}
.itemActions.simple .deleteBtn,
.expenseItem.compact .itemActions.simple .deleteBtn {
  position: relative !important;
  z-index: 2 !important;
  pointer-events: auto !important;
  min-height: 38px !important;
}
body.page-add #expenseForm .editGrid.two {
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) !important;
}
@media (max-width: 380px) {
  body.page-add #expenseForm .editGrid.two { grid-template-columns: minmax(0,1fr) minmax(0,1fr) !important; }
}

/* v71: in-app confirmation popup and shorter add memo field. */
body.page-add #note {
  min-height: 46px !important;
  height: 46px !important;
  line-height: 46px !important;
}
body.page-add #note::placeholder { line-height: 46px !important; }
.confirmPopup {
  position: fixed;
  z-index: 320;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0,0,0,.34);
}
.confirmPopup[hidden] { display: none !important; }
.confirmBox {
  width: min(340px, 100%);
  padding: 18px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0,0,0,.28);
}
.confirmBox h2 {
  margin: 0 0 8px;
  color: #111;
  font-size: 19px;
  font-weight: 950;
}
.confirmBox p {
  margin: 0;
  color: #555;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.55;
}
.confirmActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.confirmActions button { min-height: 48px; }

/* v74: month jump tabs, compact reopen label, and shorter edit memo field. */
.shareActions { grid-template-columns: repeat(3, minmax(0,1fr)) !important; }
#copyShare { display: none !important; }
.yearTabs {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.yearTabs strong {
  text-align: center;
  font-size: 14px;
  font-weight: 950;
}
.yearTabs button {
  min-height: 36px !important;
  padding: 8px 12px !important;
}
.monthTabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 6px;
  margin: 8px 0 12px;
}
.monthTabs button {
  min-width: 0;
  min-height: 34px;
  padding: 8px 4px;
  border-radius: 999px;
  background: #f7f7f7;
  color: #555;
  font-size: 12px;
  font-weight: 950;
}
.monthTabs button.isActive {
  background: #111;
  color: #fff;
  border-color: #111;
}
#listPeriodTitle,
.listPeriodNav { display: none !important; }
.yearTabs {
  margin: 2px 0 12px !important;
  padding: 8px !important;
  border: 1px solid #eeeeee !important;
  border-radius: 22px !important;
  background: linear-gradient(180deg, #fff, #fafafa) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 6px 18px rgba(0,0,0,.04) !important;
}
.yearTabs strong {
  display: grid !important;
  place-items: center !important;
  min-height: 40px !important;
  border-radius: 999px !important;
  background: #111 !important;
  color: #fff !important;
  letter-spacing: .02em !important;
}
.yearTabs button {
  background: #fff !important;
  border-color: #eeeeee !important;
  box-shadow: 0 3px 10px rgba(0,0,0,.04) !important;
}
.monthTabs {
  padding: 8px !important;
  border: 1px solid #eeeeee !important;
  border-radius: 22px !important;
  background: #fafafa !important;
}
.monthTabs button {
  background: #fff !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.035) !important;
}
.monthTabs button.isActive {
  background: #111 !important;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(0,0,0,.16) !important;
}

/* v76: alternate, sleeker year/month selector and larger home month text. */
.settlementCard .settlementPeriod strong {
  font-size: 18px !important;
}
.yearTabs {
  grid-template-columns: 42px minmax(0,1fr) 42px !important;
  gap: 10px !important;
  margin: 0 0 10px !important;
  padding: 6px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: #f4f4f5 !important;
  box-shadow: none !important;
}
.yearTabs strong {
  min-height: 42px !important;
  background: #fff !important;
  color: #111 !important;
  box-shadow: 0 4px 14px rgba(0,0,0,.06) !important;
}
.yearTabs button {
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  padding: 0 !important;
  overflow: hidden !important;
  color: transparent !important;
  position: relative !important;
}
.yearTabs button::after {
  content: "‹" !important;
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  place-items: center !important;
  color: #111 !important;
  font-size: 22px !important;
  font-weight: 950 !important;
}
.yearTabs #nextYear::after { content: "›" !important; }
.monthTabs {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0,1fr)) !important;
  gap: 6px !important;
  margin: 0 0 12px !important;
  padding: 8px !important;
  border: 1px solid #eeeeee !important;
  border-radius: 22px !important;
  background: #fafafa !important;
  overflow: visible !important;
  -webkit-overflow-scrolling: auto !important;
  scroll-snap-type: none !important;
}
.monthTabs::-webkit-scrollbar { display: none; }
.monthTabs button {
  flex: none !important;
  min-width: 0 !important;
  min-height: 34px !important;
  padding: 8px 4px !important;
  scroll-snap-align: none !important;
  background: #fff !important;
  border: 1px solid #eeeeee !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.035) !important;
  font-size: 12px !important;
}
.monthTabs button.isActive {
  min-width: 0 !important;
  background: linear-gradient(135deg, #111, #3a3a3a) !important;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(0,0,0,.16) !important;
}
@media (max-width: 360px) {
  .monthTabs { gap: 4px !important; padding: 6px !important; }
  .monthTabs button { font-size: 11px !important; padding: 7px 2px !important; }
}
#editNote {
  min-height: 46px !important;
  height: 46px !important;
  line-height: 46px !important;
}
#editNote::placeholder { line-height: 46px !important; }

/* v79: shared room status */
.shareStatus {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
}

/* v81: home settlement period range */
.periodRangeTitle {
  display: block;
  margin-top: 3px;
  color: rgba(255,255,255,.72);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.35;
  white-space: nowrap;
}

/* v82: readable period range and undo snackbar */
.settlementCard .settlementPeriod .periodRangeTitle {
  color: #555 !important;
  opacity: 1 !important;
}
.toast.hasUndo {
  display: grid !important;
  grid-template-columns: auto minmax(0,1fr) auto !important;
  align-items: center !important;
  gap: 10px !important;
  bottom: calc(92px + env(safe-area-inset-bottom)) !important;
  width: min(486px, calc(100vw - 36px)) !important;
  max-width: calc(100vw - 36px) !important;
  min-height: 58px !important;
  max-height: none !important;
  padding: 12px 16px !important;
  border-radius: 18px !important;
  background: rgba(255,255,255,.98) !important;
  color: #111 !important;
  box-shadow: 0 18px 44px rgba(38,50,64,.18) !important;
  font-size: 18px !important;
  font-weight: 950 !important;
  line-height: 1.2 !important;
  white-space: normal !important;
  overflow: visible !important;
}
.toastCheck {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 3px solid #36ad32;
  border-radius: 50%;
  color: #36ad32;
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
}
.toastMessage {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toastUndoButton {
  padding: 4px 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #007aff !important;
  box-shadow: none !important;
  font-size: 17px !important;
  font-weight: 950 !important;
  white-space: nowrap;
}
