/* 経費一覧。スマホでの入力を主目的にする。
 * 入力欄は必ず16px以上にする。これを下回るとiOSが focus のたびにページを拡大し、
 * 一件入力するごとに手で戻すことになって操作にならない。
 */

/* ---- 上部の指標 ---- */
.sacct-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.sacct-stats > div {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-1, #fcfcfb);
  border: 1px solid var(--border, #dcdbd5);
  line-height: 1.3;
}
.sacct-stats b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.sacct-stats span { font-size: 11px; color: var(--text-muted, #7c7b75); }
.sacct-stats .is-neg b { color: var(--critical, #d03b3b); }

/* ---- 絞り込み ---- */
.sacct-filterbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.sacct-seg-wide { display: flex; gap: 6px; }
.sacct-seg-wide .sacct-btn { flex: 1; text-align: center; padding: 9px 6px; }

.sacct-filterbar select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;              /* iOSの自動ズーム防止 */
  color: inherit;
  background: var(--surface-1, #fcfcfb);
  border: 1px solid var(--border, #dcdbd5);
  border-radius: 10px;
}

/* ---- まとめて入力 ---- */
.sacct-bulk {
  margin-bottom: 12px;
  border: 1px solid var(--border, #dcdbd5);
  border-radius: 10px;
  background: var(--surface-1, #fcfcfb);
  overflow: hidden;
}
.sacct-bulk > summary {
  padding: 12px 14px;
  cursor: pointer;
  font-size: 14px;
  list-style: none;
}
.sacct-bulk > summary::-webkit-details-marker { display: none; }
.sacct-bulk > summary::before { content: '＋ '; opacity: .6; }
.sacct-bulk[open] > summary::before { content: '− '; }
.sacct-bulk-body {
  display: flex; flex-direction: column; gap: 8px;
  padding: 0 14px 14px;
}
.sacct-bulk-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sacct-bulk-msg { font-size: 12px; opacity: 0; transition: opacity .2s; }
.sacct-bulk-msg.is-on { opacity: .8; }

/* ---- 明細カード ---- */
.sacct-items { display: flex; flex-direction: column; gap: 8px; }

.sacct-item {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-1, #fcfcfb);
  border: 1px solid var(--border, #dcdbd5);
}
.sacct-item.is-need { border-color: var(--border-strong, #c4c3bc); }
.sacct-item.is-todo { border-left: 3px solid var(--accent, #2a78d6); }

.sacct-item-head {
  display: flex; align-items: baseline; gap: 8px;
}
.sacct-item-date {
  font-size: 12px; color: var(--text-muted, #7c7b75);
  font-variant-numeric: tabular-nums; flex: none;
}
.sacct-item-shop {
  flex: 1; min-width: 0;
  font-size: 15px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sacct-item-amt {
  flex: none; font-size: 15px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sacct-item-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; font-size: 11px; color: var(--text-muted, #7c7b75);
}
.sacct-chip {
  padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2, #efeeea);
  color: var(--text-secondary, #52514e);
}
.sacct-item-paid { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sacct-item-fields {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 10px;
}

/* 入力欄。16px未満にしないこと(iOSが拡大する) */
.sacct-item-fields input[type="text"],
.sacct-bulk-body input[type="text"] {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px;
  font: inherit; font-size: 16px;
  color: inherit;
  background: var(--surface-0, #f4f3f0);
  border: 1px solid var(--border, #dcdbd5);
  border-radius: 8px;
}
.sacct-item-fields input:focus,
.sacct-bulk-body input:focus {
  outline: none;
  border-color: var(--accent, #2a78d6);
  background: var(--surface-1, #fcfcfb);
}
.sacct-item-fields input:disabled { opacity: .5; }

.sacct-mini { align-self: flex-start; padding: 6px 12px; font-size: 12px; }

.sacct-item.is-dirty { border-color: var(--accent, #2a78d6); }

.sacct-empty { text-align: center; padding: 40px 16px; color: var(--text-muted, #7c7b75); }

/* ---- ページ送り ---- */
.sacct-pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 14px;
}
.sacct-pager .sacct-btn { padding: 10px 18px; }
.sacct-pager-pos { font-size: 13px; color: var(--text-muted, #7c7b75); font-variant-numeric: tabular-nums; }

/* ---- 保存バー ---- */
/* タブバーの上に貼り付ける。452件を下までスクロールして保存を探す状態にしない。 */
.sacct-savebar {
  position: sticky;
  bottom: calc(58px + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 14px -4px 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-1, #fcfcfb);
  border: 1px solid var(--border-strong, #c4c3bc);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .12);
}
.sacct-savebar-note { font-size: 12px; color: var(--text-muted, #7c7b75); }
.sacct-savebar .sacct-btn { padding: 10px 24px; font-size: 15px; }
.sacct-savebar.is-dirty { border-color: var(--accent, #2a78d6); }

.sacct-flash {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border, #dcdbd5);
  background: var(--surface-2, #efeeea);
  font-size: 14px;
}

/* ---- 画面が広いとき ---- */
@media (min-width: 760px) {
  .sacct-item-fields { flex-direction: row; align-items: center; }
  .sacct-item-fields input[type="text"] { flex: 1; }
  .sacct-mini { align-self: auto; flex: none; }
  .sacct-bulk-body { flex-direction: row; align-items: center; }
  .sacct-bulk-body input[type="text"] { flex: 1; }
  .sacct-savebar { bottom: 12px; }
}

/* ---- 区切り(給与画面) ---- */
.sacct-sec { margin-bottom: 26px; }
.sacct-sec-h {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 10px; font-size: 15px;
}
.sacct-sec-h span {
  font-size: 11px; font-weight: 400;
  color: var(--text-muted, #7c7b75);
}

/* 月別の入金 */
.sacct-months { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.sacct-month { display: flex; align-items: center; gap: 10px; }
.sacct-month-label {
  flex: none; width: 2.6em; text-align: right;
  font-size: 12px; color: var(--text-muted, #7c7b75);
  font-variant-numeric: tabular-nums;
}
.sacct-month-bar {
  flex: 1; height: 8px; border-radius: 999px;
  background: var(--surface-2, #efeeea); overflow: hidden;
}
.sacct-month-bar i {
  display: block; height: 100%; border-radius: 999px;
  background: var(--accent, #2a78d6);
}
.sacct-month-amt {
  flex: none; width: 6.5em; text-align: right;
  font-size: 12px; font-variant-numeric: tabular-nums;
}


/* ---- まとまり(月別・科目別) ---- */
.sacct-grp { margin-bottom: 14px; }

.sacct-grp-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 8px 8px 0 0;
  background: var(--surface-2, #efeeea);
  border: 1px solid var(--border, #dcdbd5);
  border-bottom: none;
}
.sacct-grp-title { font-size: 13px; font-weight: 700; flex: 1; min-width: 0;
                   overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sacct-grp-meta  { font-size: 11px; color: var(--text-muted, #7c7b75); flex: none; }
.sacct-grp-sum   { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }

/* ---- 明細の表 ---- */
.sacct-tbl {
  width: 100%; border-collapse: collapse; table-layout: fixed;
  background: var(--surface-1, #fcfcfb);
  border: 1px solid var(--border, #dcdbd5);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}
.sacct-tbl td { padding: 6px 8px; vertical-align: middle; }

.sacct-row + .sacct-row td,
.sacct-row-fields + .sacct-row td { border-top: 1px solid var(--border, #dcdbd5); }

.sacct-c-date { width: 3.4em; font-size: 11px; color: var(--text-muted, #7c7b75);
                font-variant-numeric: tabular-nums; white-space: nowrap; }
.sacct-c-shop { overflow: hidden; }
.sacct-c-amt  { width: 5.4em; text-align: right; font-size: 14px; font-weight: 600;
                font-variant-numeric: tabular-nums; white-space: nowrap; }

.sacct-shop { display: block; font-size: 14px;
              overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sacct-acct { display: block; font-size: 10px; color: var(--text-muted, #7c7b75); }

.sacct-row.is-todo .sacct-c-date { box-shadow: inset 3px 0 0 var(--accent, #2a78d6); }

/* 入力行 */
.sacct-row-fields td { padding: 0 8px 8px; }
.sacct-row-fields input[type="text"] {
  width: calc(50% - 24px); box-sizing: border-box;
  padding: 7px 9px; margin-right: 4px;
  font: inherit; font-size: 16px;      /* iOSの自動ズーム防止。16px未満にしないこと */
  color: inherit;
  background: var(--surface-0, #f4f3f0);
  border: 1px solid var(--border, #dcdbd5);
  border-radius: 6px;
}
.sacct-row-fields input:focus {
  outline: none; border-color: var(--accent, #2a78d6);
  background: var(--surface-1, #fcfcfb);
}
.sacct-row-fields .sacct-mini { padding: 5px 8px; font-size: 11px; vertical-align: middle; }
.sacct-row-fields.is-dirty input { border-color: var(--accent, #2a78d6); }

@media (min-width: 620px) {
  .sacct-c-date { width: 4.4em; font-size: 12px; }
  .sacct-shop { font-size: 15px; }
  .sacct-row-fields input[type="text"] { width: calc(50% - 30px); }
}

/* ---- 給与の表 ---- */
.sacct-tbl-sal { border-radius: 8px; }
.sacct-tbl-sal thead th {
  padding: 7px 8px; font-size: 11px; font-weight: 600; text-align: right;
  color: var(--text-muted, #7c7b75);
  background: var(--surface-2, #efeeea);
  border-bottom: 1px solid var(--border, #dcdbd5);
}
.sacct-tbl-sal thead th:first-child { text-align: left; }
.sacct-tbl-sal tbody tr + tr td { border-top: 1px solid var(--border, #dcdbd5); }
.sacct-tbl-sal td { padding: 8px; }
.sacct-c-name { font-size: 13px; line-height: 1.35; }
.sacct-tbl-sal .sacct-c-amt { width: 5.8em; font-size: 13px; }
.sacct-dim { color: var(--text-muted, #7c7b75); font-weight: 400; }

/* ---- 収支の見出し ---- */
.sacct-headline {
  padding: 16px 18px; margin-bottom: 12px; border-radius: 12px;
  background: var(--surface-1, #fcfcfb);
  border: 1px solid var(--accent, #2a78d6);
}
.sacct-headline-label { font-size: 12px; color: var(--text-muted, #7c7b75); }
.sacct-headline-value {
  font-size: 30px; font-weight: 700; line-height: 1.2; margin: 2px 0 4px;
  font-variant-numeric: tabular-nums; color: var(--accent, #2a78d6);
}
.sacct-headline-value span { font-size: 14px; font-weight: 400; margin-left: 4px; }
.sacct-headline-sub { font-size: 12px; color: var(--text-secondary, #52514e); line-height: 1.6; }

.sacct-c-kind { width: 5.6em; }
.sacct-chip.is-save { background: color-mix(in srgb, var(--accent, #2a78d6) 18%, transparent); }
.sacct-chip.is-fix  { background: color-mix(in srgb, currentColor 10%, transparent); }
.sacct-tbl-sal tfoot td { border-top: 2px solid var(--border-strong, #c4c3bc); padding: 9px 8px; }
.sacct-month-amt.is-neg { color: var(--critical, #d03b3b); }

/* 収入と支出を上下に重ねた帯 */
.sacct-bar2 { display: flex; flex-direction: column; gap: 2px; height: 12px; background: none; }
.sacct-bar2 i { height: 5px; border-radius: 999px; }
.sacct-bar2 .is-in  { background: var(--accent, #2a78d6); }
.sacct-bar2 .is-out { background: var(--critical, #d03b3b); opacity: .75; }

/* ---- 振り分けの目安 ---- */
.sacct-alloc-top { display: flex; gap: 8px; margin-bottom: 10px; }
.sacct-alloc-top > div {
  flex: 1; padding: 9px 12px; border-radius: 10px;
  background: var(--surface-2, #efeeea); font-size: 12px;
}
.sacct-alloc-top span { display: block; color: var(--text-muted, #7c7b75); font-size: 11px; }
.sacct-alloc-top b { font-size: 17px; font-variant-numeric: tabular-nums; margin-right: 2px; }

.sacct-steps { list-style: none; margin: 0; padding: 0;
               display: flex; flex-direction: column; gap: 8px; }
.sacct-step {
  padding: 11px 13px; border-radius: 10px;
  background: var(--surface-1, #fcfcfb);
  border: 1px solid var(--border, #dcdbd5);
}
.sacct-step-head { display: flex; align-items: baseline; gap: 8px; }
.sacct-step-no {
  flex: none; width: 20px; height: 20px; line-height: 20px; text-align: center;
  border-radius: 50%; font-size: 11px; font-weight: 700;
  background: var(--accent, #2a78d6); color: #fff;
}
.sacct-step-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.sacct-step-amt { flex: none; font-size: 15px; font-weight: 700;
                  font-variant-numeric: tabular-nums; }
.sacct-step-amt small { font-size: 10px; font-weight: 400; opacity: .7; margin-left: 2px; }
.sacct-step-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
                   margin-top: 7px; font-size: 11px; }
.sacct-step-note { margin: 7px 0 0; font-size: 12px; line-height: 1.6;
                   color: var(--text-secondary, #52514e); }
