:root {
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-light: #ccfbf1;
  --ink: #1f2937;
  --sub: #6b7280;
  --line: #e5e7eb;
  --bg: #f9fafb;
  --card: #ffffff;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --orange: #c2410c;
  --orange-bg: #ffedd5;
  --green: #15803d;
  --green-bg: #dcfce7;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 560px; margin: 0 auto; padding: 12px 12px 40px; }
.loading { text-align: center; color: var(--sub); padding: 40px 0; }
h1 { font-size: 20px; margin: 8px 0 12px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
h3 { font-size: 15px; margin: 14px 0 6px; }
a { color: var(--teal); }

/* cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.muted { color: var(--sub); font-size: 13px; }
.small { font-size: 13px; }
.big-amount { font-size: 18px; font-weight: 700; }
.chevron { color: var(--sub); flex: none; }

/* buttons & inputs */
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 9px 14px; min-height: 44px; text-decoration: none; display: inline-block; text-align: center;
}
button.primary, .btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 700; }
button.danger { color: var(--red); border-color: var(--red-bg); }
button:disabled { opacity: .45; cursor: default; }
button.chip { min-height: 38px; padding: 6px 12px; border-radius: 999px; }
button.chip.on { background: var(--teal); color: #fff; border-color: var(--teal); font-weight: 700; }
input, select, textarea {
  font: inherit; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal-light); border-color: var(--teal); }
label.f { display: block; margin-bottom: 10px; }
label.f > span { display: block; font-size: 13px; color: var(--sub); margin-bottom: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* header / back */
.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.backbtn { width: 44px; min-width: 44px; padding: 0; font-size: 18px; }
.topbar .title { font-size: 17px; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* tabs */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 14px; }
.tabs button { padding: 8px 2px; font-size: 13px; border-radius: 10px; }
.tabs button.on { background: var(--teal); color: #fff; border-color: var(--teal); font-weight: 700; }

/* avatar */
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--teal-light); color: var(--teal-dark);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none;
}

/* badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; background: var(--sub); }
.badge.red { background: var(--red); }
.badge.green { background: var(--green); }
.badge.orange { background: var(--orange); }
.badge.teal { background: var(--teal); }
.badge.gray { background: #9ca3af; }

/* item status frames */
.item-card { border: 2px solid var(--line); }
.item-card.st-unassigned { border-color: var(--red); }
.item-card.st-done { border-color: var(--teal); }
.item-card.st-partial { border-color: var(--orange); }
.item-card.st-mismatch { border-color: var(--red); background: #fff7f7; }

/* payer band */
.payer-band {
  background: var(--teal-dark); color: #fff; border-radius: 10px; padding: 6px 8px;
  display: flex; align-items: center; gap: 8px;
}
.payer-band select {
  background: transparent; border: none; color: #fff; font-weight: 700; font-size: 16px;
  width: auto; flex: 1; min-height: 40px; padding: 4px;
}
.payer-band select option { color: var(--ink); }
.payer-band .full { font-weight: 700; white-space: nowrap; }
.payer-wrap { border: 3px solid var(--teal-dark); border-radius: var(--radius); padding: 10px; background: #f0fdfa; }
.payer-wrap h3 { margin-top: 0; }

/* banners */
.banner { border-radius: var(--radius); padding: 12px; margin-bottom: 10px; font-weight: 700; }
.banner.ok { background: var(--green-bg); color: var(--green); }
.banner.warn { background: var(--orange-bg); color: var(--orange); }
.banner.err { background: var(--red-bg); color: var(--red); }
.banner.info { background: var(--teal-light); color: var(--teal-dark); }

/* progress bar */
.pbar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.pbar > div { height: 100%; background: var(--teal); }

/* collapsible */
.collapse-head { width: 100%; display: flex; justify-content: space-between; align-items: center; background: none; border: none; padding: 6px 0; min-height: 40px; font-weight: 700; }
.collapse-head .chev { transition: transform .15s; }
.collapse-head.open .chev { transform: rotate(180deg); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25); z-index: 50; max-width: 90vw; text-align: center;
}

/* category bars */
.cat-row { margin-bottom: 8px; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.modal { background: #fff; width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 16px 14px 28px; }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: none; }
.transfer-paid { border: 2px solid var(--teal); background: #f0fdfa; }
img.receipt-photo { width: 100%; border-radius: 8px; border: 1px solid var(--line); }
