/* おこづかい — Soft UI (FromU V6) */
:root {
  --bg-base: #eef2f6;
  --card-surface: #f4f7fb;
  --main-color: #11689c;
  --accent-color: #fba0af;
  --color-success: #2cb696;
  --color-error: #e57373;
  --color-warning: #ffb74d;
  --text-heading: #1e293b;
  --text-body: #334155;
  --text-muted: #64748b;

  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 32px;
  --radius: 16px;
  --radius-pill: 100px;

  --shadow-base: 12px 12px 28px rgba(51, 65, 85, 0.10), -10px -10px 24px rgba(255, 255, 255, 0.9);
  --shadow-hover: 8px 12px 24px rgba(51, 65, 85, 0.16), -8px -8px 20px rgba(255, 255, 255, 0.95);
  --shadow-inset: inset 4px 4px 10px rgba(51, 65, 85, 0.12), inset -4px -4px 10px rgba(255, 255, 255, 0.9);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  background: var(--bg-base);
  color: var(--text-body);
  padding-bottom: 96px; /* タブバー分 */
}

.app { max-width: 520px; margin: 0 auto; padding: var(--space-md); }

header.top {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: var(--space-md) var(--space-sm) var(--space-sm);
}
header.top h1 { font-size: 20px; margin: 0; color: var(--text-heading); }
header.top .who { font-size: 13px; color: var(--text-muted); }

/* ---- カード ---- */
.card {
  background: var(--card-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-base);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

/* ---- 残高ヒーロー ---- */
.balance { text-align: center; }
.balance .label { font-size: 13px; color: var(--text-muted); letter-spacing: .08em; }
.balance .yen {
  font-size: 52px; font-weight: 800; color: var(--main-color);
  line-height: 1.1; margin: 6px 0 2px;
}
.balance .sub { display: flex; gap: var(--space-md); justify-content: center; margin-top: 12px; }
.balance .sub div { font-size: 13px; color: var(--text-muted); }
.balance .sub b { display: block; font-size: 18px; color: var(--text-body); font-weight: 700; }

/* 目標ゲージ */
.goal { margin-top: var(--space-md); }
.goal .row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.goal .bar { height: 14px; border-radius: var(--radius-pill); box-shadow: var(--shadow-inset); overflow: hidden; }
.goal .bar > span {
  display: block; height: 100%; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent-color), var(--main-color));
  transition: width .5s ease-out;
}

/* ---- ボタン ---- */
button {
  font-family: inherit; font-size: 16px; font-weight: 700;
  border: none; cursor: pointer; border-radius: var(--radius-pill);
  padding: 14px 22px; transition: all .3s ease-out;
  background: var(--card-surface); color: var(--text-body);
  box-shadow: var(--shadow-base);
}
button:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
button:active { transform: translateY(2px); box-shadow: var(--shadow-inset); }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: var(--shadow-inset); }
button.primary { background: var(--main-color); color: #fff; }
button.accent { background: var(--accent-color); color: #fff; }
button.success { background: var(--color-success); color: #fff; }
button.danger { background: var(--color-error); color: #fff; }
button.ghost { box-shadow: var(--shadow-inset); }
button.full { width: 100%; }
button.sm { font-size: 14px; padding: 9px 14px; }

/* ---- 入力 ---- */
label.field { display: block; font-size: 13px; color: var(--text-muted); margin: var(--space-md) 0 6px; }
input, select, textarea {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--text-body);
  border: none; border-radius: 12px; padding: 13px 15px;
  background: var(--bg-base); box-shadow: var(--shadow-inset); outline: none;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--main-color); outline-offset: 3px; }

.section-title { font-size: 15px; font-weight: 700; color: var(--text-heading); margin: 0 0 var(--space-md); }

/* ---- メニュー・タスクの選択チップ ---- */
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.chip {
  text-align: left; background: var(--card-surface); border-radius: var(--radius);
  box-shadow: var(--shadow-base); padding: var(--space-md); cursor: pointer;
  transition: all .3s ease-out;
}
.chip:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.chip.selected { outline: 2px solid var(--main-color); outline-offset: 2px; }
.chip .n { font-weight: 700; color: var(--text-heading); font-size: 15px; }
.chip .p { color: var(--main-color); font-weight: 800; margin-top: 4px; }
.chip .u { color: var(--text-muted); font-size: 12px; }

/* 計算プレビュー */
.preview {
  text-align: center; font-size: 15px; color: var(--text-body);
  padding: var(--space-md); border-radius: 12px; box-shadow: var(--shadow-inset); margin-top: var(--space-md);
}
.preview b { font-size: 26px; color: var(--main-color); }

/* ---- リスト（履歴・承認待ち） ---- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card-surface); border-radius: 12px; box-shadow: var(--shadow-base);
  padding: 12px 14px;
}
.item .ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; flex: none; box-shadow: var(--shadow-inset); }
.item .ic.earn { color: var(--color-success); }
.item .ic.payout { color: var(--color-error); }
.item .mid { flex: 1; min-width: 0; }
.item .mid .t { font-weight: 700; color: var(--text-heading); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .mid .d { font-size: 12px; color: var(--text-muted); }
.item .amt { font-weight: 800; font-size: 16px; }
.item .amt.earn { color: var(--color-success); }
.item .amt.payout { color: var(--color-error); }
.badge { font-size: 11px; padding: 2px 8px; border-radius: var(--radius-pill); font-weight: 700; }
.badge.pending { background: var(--color-warning); color: var(--text-heading); }
.badge.rejected { background: var(--color-error); color: #fff; }

.item .acts { display: flex; gap: 6px; }

/* ---- タブバー ---- */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  display: flex; justify-content: space-around;
  max-width: 520px; margin: 0 auto;
  background: var(--card-surface);
  box-shadow: 0 -8px 24px rgba(51, 65, 85, 0.10);
  border-radius: 22px 22px 0 0; padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
nav.tabs button {
  flex: 1; background: transparent; box-shadow: none; border-radius: 14px;
  padding: 8px 4px; font-size: 11px; color: var(--text-muted); font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
nav.tabs button .em { font-size: 20px; }
nav.tabs button.active { color: var(--main-color); box-shadow: var(--shadow-inset); }
nav.tabs button:hover { transform: none; }

/* ---- ページ切替 ---- */
.page { display: none; }
.page.active { display: block; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- トースト ---- */
#toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px);
  background: var(--text-heading); color: #fff; padding: 12px 20px; border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .3s ease-out; z-index: 9999;
  box-shadow: var(--shadow-base); max-width: 90%;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--color-error); }

/* ---- 給与明細 ---- */
.slip { display: flex; flex-direction: column; }
.slip .r { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 2px; font-size: 15px; }
.slip .r + .r { border-top: 1px solid rgba(100,116,139,.12); }
.slip .r .k { color: var(--text-body); }
.slip .r .v { font-weight: 700; color: var(--text-heading); font-variant-numeric: tabular-nums; }
.slip .r.minus .v { color: var(--color-error); }
.slip .r.total { margin-top: 4px; }
.slip .r.total .k { font-weight: 700; }
.slip .r.total .v { font-size: 20px; color: var(--main-color); }
.slip .r.sub .k, .slip .r.sub .v { color: var(--text-muted); font-size: 13px; font-weight: 600; }

/* ---- 回数カウンター ---- */
.counter { display: flex; align-items: center; gap: 14px; justify-content: center; margin-top: 6px; }
.counter input {
  width: 96px; text-align: center; font-size: 28px; font-weight: 800; color: var(--main-color);
  padding: 10px; -moz-appearance: textfield;
}
.counter input::-webkit-outer-spin-button, .counter input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
button.round {
  width: 56px; height: 56px; border-radius: 50%; font-size: 28px; font-weight: 800;
  padding: 0; flex: none; line-height: 1;
}

/* ---- メニューのフォルダー（アコーディオン） ---- */
.menu-groups { display: flex; flex-direction: column; gap: var(--space-md); }
.menu-groups > .chips { margin: 0; }
.folder { border-radius: var(--radius); box-shadow: var(--shadow-inset); overflow: hidden; }
.folder-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: var(--card-surface); box-shadow: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 700; color: var(--text-heading); padding: 14px 18px;
}
.folder-head:hover { transform: none; }
.folder-head .chev { transition: transform .3s ease-out; color: var(--text-muted); font-size: 13px; }
.folder.open .folder-head .chev { transform: rotate(180deg); }
.folder-body { max-height: 0; overflow: hidden; transition: max-height .35s ease-out; }
.folder.open .folder-body { max-height: 1200px; }
.folder-body .chips { padding: 14px; }

/* ---- タスク種類トグル ---- */
button.toggle {
  font-size: 14px; padding: 12px 8px; box-shadow: var(--shadow-inset);
  color: var(--text-muted); background: var(--bg-base);
}
button.toggle.active { background: var(--main-color); color: #fff; box-shadow: var(--shadow-base); }
button.toggle:hover { transform: none; }

/* ---- ストップウォッチ ---- */
.stopwatch { margin-top: var(--space-md); text-align: center; }
.clock {
  font-size: 56px; font-weight: 800; color: var(--text-heading); letter-spacing: .04em;
  font-variant-numeric: tabular-nums; line-height: 1.1; margin-bottom: 6px;
}
.stopwatch.running .clock { color: var(--main-color); }
.stopwatch .rowflex button { font-size: 15px; padding: 12px 8px; }

/* ---- しごとのルール ---- */
ul.rules { list-style: none; margin: 0; padding: 0; }
ul.rules li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 2px; font-size: 15px; color: var(--text-body);
}
ul.rules li + li { border-top: 1px solid rgba(100,116,139,.12); }
ul.rules li::before { content: "✅"; flex: none; font-size: 15px; line-height: 1.4; }

.rule-edit { display: flex; gap: 8px; align-items: center; }
.rule-edit input { flex: 1; }
.rule-edit button { flex: none; }

/* ---- 控除エディタ ---- */
.ded { display: flex; gap: 8px; align-items: center; }
.ded input.dn { flex: 2; }
.ded input.dr { flex: 1; text-align: right; }
.ded .pct { color: var(--text-muted); font-size: 14px; }
.ded button { flex: none; }

.muted { color: var(--text-muted); font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: var(--space-md); }
.hidden { display: none !important; }
.rowflex { display: flex; gap: 10px; align-items: center; }
.rowflex > * { flex: 1; }
hr.sep { border: none; border-top: 1px solid rgba(100,116,139,.15); margin: var(--space-md) 0; }
