:root {
  --bg: #f4f7f1;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --text: #263027;
  --muted: #69736a;
  --line: #dfe6dc;
  --green: #4f8f46;
  --green-strong: #327431;
  --green-soft: #e7f2e3;
  --orange: #d87e2e;
  --orange-soft: #fff0df;
  --red: #d44a55;
  --red-soft: #fde9eb;
  --blue: #3b76b8;
  --blue-soft: #e7f0fb;
  --purple: #7353b6;
  --purple-soft: #eee8fb;
  --shadow: 0 10px 30px rgba(38, 48, 39, 0.08);
  --radius: 22px;
  --radius-sm: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 10% 0%, rgba(117, 168, 106, 0.13), transparent 28rem),
    radial-gradient(circle at 100% 8%, rgba(208, 233, 202, 0.48), transparent 32rem),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell {
  width: min(100%, 1040px);
  margin: 0 auto;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: rgba(244, 247, 241, 0.9);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(223, 230, 220, 0.9);
}

.month-switcher,
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.month-btn,
.icon-btn,
.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.action-btn,
.status-btn,
.more-btn {
  border: 0;
  border-radius: 999px;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.month-btn:active,
.icon-btn:active,
.primary-btn:active,
.secondary-btn:active,
.ghost-btn:active,
.action-btn:active,
.status-btn:active,
.more-btn:active {
  transform: scale(0.97);
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 3px 12px rgba(38, 48, 39, 0.08);
  font-size: 24px;
}

.month-btn {
  min-height: 42px;
  padding: 4px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: transparent;
  color: var(--text);
  font-size: clamp(17px, 4vw, 22px);
  font-weight: 750;
  line-height: 1.15;
}

.management-period {
  display: block;
  color: var(--muted);
  font-size: clamp(10px, 2.7vw, 12px);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.primary-btn {
  background: linear-gradient(135deg, var(--green), var(--green-strong));
  color: white;
  font-weight: 750;
  padding: 12px 20px;
  box-shadow: 0 8px 18px rgba(79, 143, 70, 0.25);
}

.primary-btn.compact {
  padding: 11px 16px;
  white-space: nowrap;
}

.secondary-btn {
  padding: 11px 16px;
  background: var(--green-soft);
  color: var(--green-strong);
  font-weight: 700;
}

.ghost-btn {
  padding: 11px 16px;
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 650;
}

.danger-btn {
  padding: 11px 16px;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 750;
}

.full-width {
  width: 100%;
}

.main-content {
  display: grid;
  gap: 14px;
  padding: 14px 14px calc(40px + var(--safe-bottom));
}

.free-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 16px;
  min-height: 210px;
  padding: 28px 24px;
  border: 1px solid #cfe1c9;
  border-radius: 28px;
  background:
    radial-gradient(circle at 90% 110%, rgba(79, 143, 70, 0.24), transparent 48%),
    radial-gradient(circle at 78% 5%, rgba(255, 255, 255, 0.9), transparent 34%),
    linear-gradient(135deg, #f7fbf5, #eaf4e6);
  box-shadow: var(--shadow);
}

.free-card::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -70px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 44px solid rgba(79, 143, 70, 0.08);
}

.free-card__icon {
  position: relative;
  z-index: 1;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 18px rgba(79, 143, 70, 0.14);
  font-size: 28px;
}

.eyebrow {
  margin: 2px 0 2px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.free-amount {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--green-strong);
  font-size: clamp(48px, 14vw, 78px);
  font-weight: 850;
  letter-spacing: -0.04em;
  line-height: 1.02;
}

.free-caption {
  margin: 10px 0 0;
  color: var(--text);
  font-size: 15px;
}

.danger-message {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 13px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 750;
  font-size: 14px;
}

.free-card.warning {
  border-color: #edc496;
  background: linear-gradient(135deg, #fffaf3, #fff0df);
}

.free-card.warning .free-amount {
  color: var(--orange);
}

.free-card.danger {
  border-color: #efb0b6;
  background: linear-gradient(135deg, #fff8f8, #fde9eb);
}

.free-card.danger .free-amount {
  color: var(--red);
}

.alert-panel {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--red-soft);
  color: #8d2630;
  border: 1px solid #efc1c5;
  box-shadow: var(--shadow);
}

.alert-panel ul {
  margin: 8px 0 0 1.2rem;
  padding: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.summary-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 118px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(38, 48, 39, 0.05);
}

.summary-card p,
.summary-card strong,
.summary-card small {
  display: block;
}

.summary-card p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-card strong {
  margin-bottom: 5px;
  font-size: clamp(20px, 5vw, 27px);
  line-height: 1.1;
}

.summary-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.summary-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  font-weight: 900;
}

.summary-icon.income { background: var(--green-soft); color: var(--green); }
.summary-icon.expense { background: var(--orange-soft); color: var(--orange); }
.summary-icon.savings { background: var(--red-soft); color: var(--red); }
.summary-icon.carry { background: var(--blue-soft); color: var(--blue); }

.panel {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 6px 22px rgba(38, 48, 39, 0.05);
}

.section-heading,
.section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 18px;
}

.section-heading h2,
.section-heading p,
.section-toggle strong,
.section-toggle small {
  margin: 0;
}

.section-heading h2,
.section-toggle strong {
  font-size: 18px;
}

.section-heading p,
.section-toggle small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.section-toggle {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.chevron {
  color: var(--muted);
  font-size: 20px;
}

.more-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  font-weight: 900;
}

.section-body {
  padding: 0 14px 14px;
}

.empty-state {
  padding: 22px 12px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
}

.account-cards {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding: 0 16px 17px 22px;
  scroll-padding-inline: 22px;
  scroll-snap-type: x proximity;
}

.account-card {
  scroll-snap-align: start;
  min-height: 126px;
  padding: 14px 14px 16px 18px;
  border-radius: 17px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.account-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.account-card__icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--green-soft);
}

.account-card h3 {
  margin: 11px 0 2px;
  font-size: 15px;
}

.account-card small {
  color: var(--muted);
}

.account-card strong {
  display: block;
  margin-top: 9px;
  font-size: 21px;
}

.account-card h3,
.account-card small,
.account-card strong {
  padding-left: 2px;
}

.item-list {
  display: grid;
  gap: 10px;
}

.item-row,
.statement-card,
.goal-card,
.subtotal-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px;
}

.item-main {
  min-width: 0;
}

.item-topline,
.item-meta,
.item-actions,
.statement-head,
.statement-summary,
.goal-head,
.goal-progress__labels {
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-topline,
.statement-head,
.goal-head {
  justify-content: space-between;
}

.item-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 760;
}

.item-date {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.item-meta {
  flex-wrap: wrap;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.item-amount {
  align-self: start;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 780;
}

.income-distribution-summary {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.income-distribution-summary__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.income-distribution-summary__label {
  white-space: nowrap;
  font-weight: 700;
}

.income-distribution-summary__values {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px 10px;
  text-align: right;
}

.income-distribution-summary__values strong {
  color: var(--text);
  font-weight: 760;
}

.item-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.status-planned { background: var(--orange-soft); color: var(--orange); }
.status-confirmed { background: var(--green-soft); color: var(--green-strong); }
.status-paid { background: var(--blue-soft); color: var(--blue); }
.status-skipped { background: #eeeeee; color: #666; }

.action-btn,
.status-btn {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 740;
}

.action-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
}

.status-btn.confirm {
  background: var(--green-soft);
  color: var(--green-strong);
}

.status-btn.pay {
  background: var(--blue-soft);
  color: var(--blue);
}

.statement-card {
  padding: 14px;
  margin-bottom: 12px;
}

.statement-head {
  align-items: flex-start;
}

.statement-head h3,
.goal-head h3 {
  margin: 0;
  font-size: 16px;
}

.statement-head small,
.goal-head small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.statement-summary {
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 11px 12px;
  border-radius: 13px;
  background: white;
}

.statement-summary span {
  flex: 1 1 100px;
  color: var(--muted);
  font-size: 12px;
}

.statement-summary strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 17px;
}

.subtotal-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--green-soft);
}

.subtotal-card span {
  color: var(--green-strong);
  font-weight: 700;
}

.subtotal-card strong {
  color: var(--green-strong);
  font-size: 18px;
}

.goal-card {
  padding: 14px;
  margin-bottom: 10px;
}

.goal-progress {
  height: 10px;
  overflow: hidden;
  margin-top: 12px;
  border-radius: 999px;
  background: #e6ebe4;
}

.goal-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #74ad69, var(--green-strong));
}

.goal-progress__labels {
  justify-content: space-between;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.extra-savings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 17px 13px;
}

.extra-savings-grid > div {
  padding: 14px;
  border-radius: 15px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.extra-savings-grid span,
.extra-savings-grid strong {
  display: block;
}

.extra-savings-grid span {
  color: var(--muted);
  font-size: 12px;
}

.extra-savings-grid strong {
  margin-top: 5px;
  font-size: 22px;
}

.allocation-box {
  margin: 0 17px 13px;
  padding: 13px 14px;
  border-radius: 15px;
  background: var(--green-soft);
  color: var(--green-strong);
}

.allocation-box:empty {
  display: none;
}

#applyRecommendedSavingsBtn {
  width: calc(100% - 34px);
  margin: 0 17px 17px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
}

.form-row {
  display: grid;
  gap: 6px;
}

.form-row.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-row label,
.field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #ccd6c9;
  border-radius: 12px;
  background: white;
  color: var(--text);
  outline: none;
}

.form-row textarea {
  min-height: 92px;
  resize: vertical;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(79, 143, 70, 0.13);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--text);
  font-size: 14px;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.helper-text {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.register-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.register-option {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  text-align: left;
  color: var(--text);
}

.register-option strong,
.register-option small {
  display: block;
}

.register-option strong {
  margin-top: 8px;
}

.register-option small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.settings-section {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.settings-section:last-child {
  border-bottom: 0;
}

.settings-section h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.settings-actions {
  display: grid;
  gap: 8px;
}

.settings-actions--data-management {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.settings-action-row {
  display: grid;
  gap: 8px;
}

.settings-action-row--data-buttons,
.settings-action-row--face-id-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-action-row--data-buttons > button,
.settings-action-row--face-id-buttons > button,
.settings-action-row--utility-buttons > button {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
}

.settings-action-row--face-id-buttons > button:only-child {
  grid-column: 1 / -1;
}

.settings-action-row--utility-buttons {
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.72fr) minmax(0, 0.78fr);
}

.settings-action-row--utility-buttons > button {
  padding-inline: 10px;
}

@media (max-width: 390px) {
  .settings-action-row--utility-buttons > button {
    padding-inline: 7px;
    font-size: 12px;
  }
}

.settings-list {
  display: grid;
  gap: 8px;
}

.trash-bulk-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.trash-bulk-actions .danger-btn {
  width: 100%;
}

.settings-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}

.settings-list-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(25, 32, 26, 0.42);
  backdrop-filter: blur(3px);
}

.modal {
  position: fixed;
  z-index: 90;
  left: 50%;
  top: 50%;
  width: min(calc(100% - 24px), 620px);
  max-height: min(88vh, 820px);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 28px 70px rgba(21, 31, 23, 0.24);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 17px;
  background: var(--surface);
}

.modal-header {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 19px;
}

.modal-body {
  overflow-y: auto;
  padding: 17px;
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.action-sheet {
  position: fixed;
  z-index: 95;
  left: 50%;
  bottom: 0;
  width: min(100%, 620px);
  max-height: 82vh;
  overflow-y: auto;
  transform: translateX(-50%);
  padding: 10px 14px calc(16px + var(--safe-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  box-shadow: 0 -20px 60px rgba(21, 31, 23, 0.22);
}

.action-sheet__handle {
  width: 46px;
  height: 5px;
  margin: 2px auto 12px;
  border-radius: 999px;
  background: #cbd3c9;
}

.action-sheet h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.action-sheet-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.action-sheet-option.danger {
  color: var(--red);
}

.toast {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: calc(22px + var(--safe-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 999px;
  background: rgba(35, 44, 36, 0.94);
  color: white;
  box-shadow: 0 10px 30px rgba(35, 44, 36, 0.3);
  font-size: 14px;
}

@media (min-width: 720px) {
  .main-content {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 18px 22px 48px;
  }

  .free-card,
  .summary-grid,
  #balancesSection,
  #alertPanel,
  #extraSavingsPanel,
  .collapsible[data-section="income"],
  .collapsible[data-section="dcard"],
  .collapsible[data-section="epos"] {
    grid-column: 1 / -1;
  }

  .summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .summary-card {
    min-height: 126px;
  }

  .account-cards {
    grid-auto-columns: minmax(160px, 1fr);
  }

  .form-grid.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 410px) {
  .topbar {
    gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .month-switcher,
  .top-actions {
    gap: 4px;
  }

  #settingsBtn {
    display: grid;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }

  .month-btn {
    min-height: 42px;
    padding: 3px 4px;
    font-size: 16px;
  }

  .primary-btn.compact {
    padding: 9px 10px;
    font-size: 13px;
  }

  .main-content {
    padding-left: 10px;
    padding-right: 10px;
  }

  .free-card {
    grid-template-columns: 1fr;
    min-height: 228px;
    padding: 22px 18px;
  }

  .free-card__icon {
    width: 46px;
    height: 46px;
    font-size: 22px;
  }

  .summary-card {
    padding: 13px;
  }

  .item-row {
    grid-template-columns: 1fr;
  }

  .item-amount {
    justify-self: start;
  }

  .form-row.two-col {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .primary-btn,
  .secondary-btn,
  .ghost-btn,
  .danger-btn,
  .action-btn,
  .status-btn,
  .more-btn,
  #applyRecommendedSavingsBtn {
    display: none !important;
  }

  .main-content {
    display: block;
    padding: 0;
  }

  .panel,
  .free-card,
  .summary-grid {
    margin-bottom: 12px;
    box-shadow: none;
    break-inside: avoid;
  }

  .section-body.hidden {
    display: block !important;
  }
}


/* Local Face ID / PIN lock */
.app-locked {
  overflow: hidden;
}

.pin-lock {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 20% 15%, rgba(111, 164, 94, .18), transparent 36%),
    radial-gradient(circle at 85% 80%, rgba(242, 178, 191, .20), transparent 34%),
    #f7f9f5;
}

.pin-lock.hidden {
  display: none;
}

.pin-card {
  width: min(100%, 420px);
  padding: 28px 24px;
  border: 1px solid rgba(79, 143, 70, .18);
  border-radius: 28px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 20px 60px rgba(31, 55, 29, .14);
  text-align: center;
}

.pin-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf6e9;
  font-size: 30px;
}

.pin-card h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

.pin-description,
.pin-note {
  color: #5e685b;
  line-height: 1.65;
}

.pin-note {
  margin: 18px 0 0;
  font-size: 12px;
  text-align: left;
}

.pin-form {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  text-align: left;
}

.pin-form label {
  font-weight: 700;
  font-size: 14px;
}

.pin-form input {
  width: 100%;
  min-height: 54px;
  padding: 10px 16px;
  border: 1px solid #cfd8cc;
  border-radius: 14px;
  background: white;
  font-size: 26px;
  letter-spacing: .28em;
  text-align: center;
}

.pin-form input:focus {
  outline: 3px solid rgba(79, 143, 70, .18);
  border-color: #4f8f46;
}

.pin-confirm-row {
  display: grid;
  gap: 10px;
}

.pin-message {
  min-height: 22px;
  margin: 0;
  color: #c94053;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
}

.face-id-area {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.face-id-btn {
  min-height: 56px;
  font-size: 17px;
}

.face-id-btn::before {
  content: '◉';
  margin-right: 8px;
  font-size: 20px;
}

.pin-card > .ghost-btn {
  margin-top: 10px;
}

@media print {
  .pin-lock { display: none !important; }
}

/* iPhone: prevent the settings dialog from sliding sideways */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.modal {
  max-width: calc(100vw - 24px);
}

.modal-header,
.modal-body,
.modal-footer {
  width: 100%;
  min-width: 0;
}

.modal-body {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.modal-body > *,
.settings-section,
.settings-list,
.settings-list-item,
.settings-list-item > div,
.form-grid,
.form-row,
details {
  min-width: 0;
  max-width: 100%;
}

.form-row input,
.form-row select,
.form-row textarea {
  min-width: 0;
  max-width: 100%;
}

.settings-list-item strong,
.settings-list-item small {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.settings-list-item .more-btn {
  flex: 0 0 auto;
}

.section-title-line {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.official-app-icon {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid rgba(38, 48, 39, 0.08);
  box-shadow: 0 2px 7px rgba(38, 48, 39, 0.08);
}

.official-app-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.official-app-icon.icon-loaded .official-app-icon__fallback {
  opacity: 0;
}

.official-app-icon__fallback {
  font-weight: 800;
  transition: opacity 0.15s ease;
}

.section-app-icon {
  width: 29px;
  height: 29px;
  border-radius: 8px;
  font-size: 13px;
}

.account-card__icon.official-app-icon {
  padding: 0;
  border-radius: 11px;
}

.neutral-app-icon {
  font-weight: 400;
  font-size: 19px;
  font-family: -apple-system, BlinkMacSystemFont, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

/* iPhone Safari: keep native date/month fields inside every modal and form */
.form-row {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.form-row input[type="date"],
.form-row input[type="month"],
.form-row input[type="time"],
.form-row input[type="datetime-local"] {
  display: block;
  inline-size: 100% !important;
  width: 100% !important;
  min-inline-size: 0 !important;
  min-width: 0 !important;
  max-inline-size: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden;
}

.form-row input[type="date"]::-webkit-date-and-time-value,
.form-row input[type="month"]::-webkit-date-and-time-value,
.form-row input[type="time"]::-webkit-date-and-time-value,
.form-row input[type="datetime-local"]::-webkit-date-and-time-value {
  min-width: 0;
  width: 100%;
  text-align: left;
}

@supports (-webkit-touch-callout: none) {
  .form-row input[type="date"],
  .form-row input[type="month"],
  .form-row input[type="time"],
  .form-row input[type="datetime-local"] {
    -webkit-appearance: none;
    appearance: none;
  }
}

.modal-body .form-grid,
.modal-body form,
.modal-body details,
.modal-body details > div {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

/* iOS 26 WebKit workaround: date/month inputs overflow when width:100% and padding coexist. */
.form-row input[type="date"],
.form-row input[type="month"],
.form-row input[type="time"],
.form-row input[type="datetime-local"] {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 46px !important;
  min-height: 46px !important;
  padding: 0 !important;
  border: 1px solid #ccd6c9;
  border-radius: 12px;
  background: #fff;
  box-sizing: border-box !important;
  -webkit-appearance: none;
  appearance: none;
}

.form-row input[type="date"]::-webkit-date-and-time-value,
.form-row input[type="month"]::-webkit-date-and-time-value,
.form-row input[type="time"]::-webkit-date-and-time-value,
.form-row input[type="datetime-local"]::-webkit-date-and-time-value {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 44px;
  line-height: 24px;
  padding: 10px 12px;
  margin: 0;
  text-align: left;
}

.form-row input[type="date"]::-webkit-calendar-picker-indicator,
.form-row input[type="month"]::-webkit-calendar-picker-indicator,
.form-row input[type="time"]::-webkit-calendar-picker-indicator,
.form-row input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  margin: 0 10px 0 0;
  padding: 0;
}

.modal-body .form-row:has(input[type="date"]),
.modal-body .form-row:has(input[type="month"]),
.modal-body .form-row:has(input[type="time"]),
.modal-body .form-row:has(input[type="datetime-local"]) {
  overflow: hidden;
}

/* v12: force cash / in-transit / purpose icons to use native color emoji */
.account-card__icon.neutral-app-icon {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif !important;
  font-size: 28px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  font-variant-emoji: emoji;
}


/* v14: quick registration buttons in each section */
.section-heading-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.section-heading--collapsible {
  padding: 0;
  gap: 0;
}

.section-heading--collapsible .section-toggle {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  padding: 17px 8px 17px 18px;
}

.section-heading--collapsible .section-toggle > span:first-child {
  min-width: 0;
}

.section-heading--collapsible .chevron {
  flex: 0 0 auto;
  margin-left: 4px;
}

.section-add-btn {
  flex: 0 0 auto;
  min-height: 36px;
  margin-right: 10px;
  padding: 8px 11px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.section-add-btn:active {
  transform: scale(0.97);
}

@media (max-width: 390px) {
  .section-heading--collapsible .section-toggle {
    padding-left: 15px;
  }

  .section-add-btn {
    margin-right: 8px;
    padding-inline: 9px;
    font-size: 11px;
  }
}

/* v15: compact inline add button beside each section title */
.section-heading--collapsible {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  padding: 17px 18px;
}

.section-heading--collapsible .section-toggle {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  padding: 0;
  justify-content: flex-start;
}

.section-heading--collapsible .section-toggle > span:first-child {
  min-width: 0;
}

.section-add-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  min-height: 34px;
  margin: -3px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-strong);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.section-add-btn:active {
  transform: scale(0.94);
}

.section-collapse-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  margin: -3px 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.section-collapse-btn:active {
  background: var(--surface-soft);
  transform: scale(0.94);
}

.section-collapse-btn .chevron {
  line-height: 1;
}

/* Keep the balance section controls compact too. */
#balancesSection .section-add-btn {
  margin: 0;
}

/* v15: fixed app header that remains visible while scrolling */
:root {
  --fixed-topbar-height: 64px;
}

.topbar {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 80;
  width: min(100%, 1040px);
  transform: translateX(-50%);
  box-sizing: border-box;
}

.main-content {
  padding-top: calc(14px + var(--fixed-topbar-height));
}

@media (min-width: 720px) {
  .main-content {
    padding-top: calc(18px + var(--fixed-topbar-height));
  }
}

@media (max-width: 390px) {
  .section-heading--collapsible {
    padding-left: 15px;
    padding-right: 15px;
    gap: 6px;
  }

  .section-add-btn,
  .section-collapse-btn {
    width: 32px;
    height: 32px;
    min-height: 32px;
  }
}

@media print {
  .topbar {
    position: static !important;
    width: 100% !important;
    transform: none !important;
  }

  .main-content {
    padding-top: 0 !important;
  }
}


/* v17: place the compact + immediately beside the section title */
.section-heading-main {
  min-width: 0;
  flex: 1 1 auto;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
}

#balancesSection > .section-heading {
  align-items: flex-start;
  justify-content: space-between;
}

#balancesSection .section-heading-main > p {
  margin-top: 3px;
}

.section-heading--collapsible {
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.section-heading--collapsible .section-heading-main {
  flex: 1 1 auto;
  min-width: 0;
}

.section-heading--collapsible .section-title-row {
  width: fit-content;
  max-width: 100%;
}

.section-heading--collapsible .section-toggle,
.section-heading--collapsible .section-title-toggle {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  padding: 0;
  justify-content: flex-start;
}

.section-heading--collapsible .section-heading-main > small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.section-add-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px !important;
  height: 26px !important;
  min-height: 26px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-strong);
  font-size: 20px !important;
  font-weight: 700;
  line-height: 1;
}

.section-collapse-btn {
  flex: 0 0 auto;
  margin-left: auto;
}

@media (max-width: 390px) {
  .section-heading--collapsible {
    gap: 6px;
  }

  .section-add-btn {
    width: 24px !important;
    height: 24px !important;
    min-height: 24px !important;
    font-size: 18px !important;
  }
}

.statement-group + .statement-group {
  margin-top: 14px;
}

.statement-group__label {
  margin: 0 0 8px;
  padding-left: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
}

/* v21: payroll-period header, 3-card forecast and Paidy split funding */
.payroll-period-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.statement-card--forecast {
  position: relative;
  padding-top: 38px;
}

.statement-stage {
  position: absolute;
  top: 10px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-strong);
  font-size: 11px;
  font-weight: 800;
}

.statement-empty {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.statement-head--collapsible {
  align-items: center;
  gap: 12px;
}

.statement-head__main {
  min-width: 0;
  flex: 1 1 auto;
}

.statement-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.statement-inline-totals {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
}

.statement-inline-totals .statement-inline-total {
  margin-top: 0;
}

.statement-inline-total {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.statement-inline-total--confirmed {
  background: var(--green-soft);
  color: var(--green-strong);
}

.statement-inline-total strong {
  color: var(--text);
  font-size: 15px;
}

.statement-toggle-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 18px;
}

.statement-toggle-btn:active {
  transform: scale(0.98);
}

.statement-details {
  margin-top: 12px;
}

.paidy-allocation-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.paidy-allocation-list {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.paidy-remaining {
  color: var(--orange);
  font-weight: 750;
}

.paidy-allocated-amount {
  align-self: start;
  text-align: right;
  white-space: nowrap;
}

.paidy-allocated-amount small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.paidy-allocated-amount strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
}

.paidy-schedule-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.paidy-schedule-card + .paidy-schedule-card {
  margin-top: 12px;
}

@media (max-width: 430px) {
  .paidy-allocation-editor.two-col {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}


/* v24: align chevron and three-dot icons visually at the center */
.more-btn,
.section-collapse-btn,
.statement-toggle-btn,
.action-btn[data-action="more-item"] {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.more-btn,
.action-btn[data-action="more-item"] {
  font-size: 0 !important;
  color: transparent !important;
}

.more-btn::before,
.action-btn[data-action="more-item"]::before {
  content: "•••";
  display: block;
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1;
  transform: translateY(-1px);
}

.section-collapse-btn .chevron,
.statement-toggle-btn .chevron {
  display: block;
  width: 11px;
  height: 11px;
  font-size: 0;
  line-height: 0;
  color: var(--muted);
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform-origin: center;
}

.section-collapse-btn[aria-expanded="false"] .chevron,
.statement-toggle-btn[aria-expanded="false"] .chevron {
  transform: rotate(45deg) translate(-1px, -1px);
}

.section-collapse-btn[aria-expanded="true"] .chevron,
.statement-toggle-btn[aria-expanded="true"] .chevron {
  transform: rotate(-135deg) translate(-1px, -1px);
}


/* v31: statement-level confirmation */
.statement-card--locked { padding-bottom: 14px; }
.statement-head--locked { align-items: center; margin-bottom: 14px; }
.statement-card--locked .statement-inline-total { margin-top: 12px; }
.statement-confirm-btn { margin-bottom: 12px; font-size: 14px; }
.statement-paid-status { margin-top: 8px; }


/* v33: compact section headings without subtitles */
.section-heading-main > small,
.section-heading-main > p,
.section-heading > div > p,
.payroll-period-note {
  display: none !important;
}

.section-heading--collapsible,
#balancesSection > .section-heading {
  align-items: center;
}


/* Payment reserves */
.payment-reserve-note {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green-dark, #315f2d);
}

.payment-reserve-note span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(79, 143, 70, 0.1);
}

.payment-reserve-row .item-amount {
  white-space: nowrap;
}


/* v39: Paidy monthly reserve controls */
.status-btn.reserve {
  background: var(--orange-soft);
  color: var(--orange);
}

.paidy-month-reserve-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft, #f8faf7);
}

.paidy-month-reserve-box > div {
  display: grid;
  gap: 2px;
}


.paidy-unified-row .item-actions {
  align-self: end;
}

.paidy-inline-amount {
  display: block;
  margin-top: 12px;
  white-space: nowrap;
  font-size: 1.2rem;
}

.paidy-month-reserve-box.is-compact strong {
  font-size: 0.95rem;
}

.paidy-group-card .statement-head {
  align-items: flex-start;
  margin-bottom: 0;
}

.paidy-group-meta {
  margin-top: 8px;
}

.paidy-group-details {
  margin-top: 12px;
}

.paidy-group-card .paidy-month-reserve-box {
  margin-top: 12px;
}

.paidy-breakdown-list {
  gap: 10px;
}

.paidy-breakdown-row {
  background: #fff;
}


.paidy-month-reserve-box small {
  color: var(--muted);
  font-size: 0.76rem;
}

.paidy-month-reserve-box strong {
  font-size: 1rem;
}

.payment-reserve-target-summary {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(79, 143, 70, 0.08);
  color: var(--green-dark, #315f2d);
}

.payment-reserve-target-summary span {
  font-size: 0.78rem;
}

.payment-reserve-target-summary strong {
  font-size: 1rem;
}


/* v48: title-free compact quick-jump navigation */
:root {
  --quick-jump-visible-height: 44px;
}

.quick-jump {
  position: fixed;
  top: var(--fixed-topbar-height);
  left: 50%;
  z-index: 79;
  width: min(100%, 1040px);
  box-sizing: border-box;
  transform: translateX(-50%);
  padding: 5px 10px;
  background: rgba(244, 247, 241, 0.94);
  border-bottom: 1px solid rgba(223, 230, 220, 0.95);
  backdrop-filter: blur(18px);
}

.quick-jump__label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 8px 1px;
  color: var(--green-strong);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 750;
}

.quick-jump__menu {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 2px 0 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.quick-jump__menu::-webkit-scrollbar {
  display: none;
}

.quick-jump__menu button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  line-height: 1.15;
  font-weight: 700;
  white-space: nowrap;
}

.main-content {
  padding-top: calc(12px + var(--fixed-topbar-height) + var(--quick-jump-visible-height));
}

.main-content > section {
  scroll-margin-top: calc(var(--fixed-topbar-height) + var(--quick-jump-visible-height) + 8px);
}

@media (min-width: 720px) {
  .main-content {
    padding-top: calc(16px + var(--fixed-topbar-height) + var(--quick-jump-visible-height));
  }
}

@media print {
  .quick-jump {
    display: none !important;
  }
}

/* v48: remove visible quick-jump title */
.quick-jump__label { display: none !important; }

/* v54: Paidy monthly payment flow */
.paidy-group-primary-action {
  margin-top: 12px;
}

.paidy-group-card .paidy-month-reserve-box + .paidy-group-primary-action {
  margin-top: 14px;
}

/* v55: separate action-sheet cancel button from the options */
#actionSheetCancel {
  margin-top: 14px;
}

/* Combine reserve, savings, and normal funding in one payment */
.funding-combination-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(79, 143, 70, 0.05);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.funding-combination-toggle input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--green);
  flex: 0 0 auto;
}

/* v94: keep funding controls visually separated and show them inline at registration */
#expenseFundingSection,
#expenseRegistrationFundingSection {
  gap: 13px;
}

.registration-funding-section {
  padding-top: 2px;
}


/* v104: show direct-payment forecast and paid totals */
#directSectionSubtotal {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}

.direct-total-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
}

.direct-total-chip--paid {
  background: var(--green-soft);
  color: var(--green-strong);
}

.direct-total-chip strong {
  color: var(--text);
  font-size: 13px;
}

.direct-total-chip--paid strong {
  color: var(--green-strong);
}


/* v106: lower duplicate direct-payment totals removed */

/* v106: payment-method-specific safe spending limits */
.spending-limit-panel {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(79, 143, 70, 0.18);
}

.spending-limit-title {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.spending-limit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.spending-limit-item {
  min-width: 0;
  padding: 11px 9px;
  border: 1px solid rgba(79, 143, 70, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.spending-limit-item span,
.spending-limit-item small {
  display: block;
  color: var(--muted);
}

.spending-limit-item span {
  font-size: 12px;
  font-weight: 800;
}

.spending-limit-item strong {
  display: block;
  margin: 4px 0 3px;
  color: var(--green-strong);
  font-size: clamp(17px, 4.4vw, 22px);
  line-height: 1.15;
  white-space: nowrap;
}

.spending-limit-item small {
  font-size: 10px;
  line-height: 1.35;
}

.spending-limit-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

@media (max-width: 360px) {
  .spending-limit-grid {
    grid-template-columns: 1fr;
  }

  .spending-limit-item {
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
    text-align: left;
  }

  .spending-limit-item strong {
    margin: 0;
    text-align: right;
  }

  .spending-limit-item small {
    grid-column: 1 / -1;
    margin-top: 3px;
    text-align: right;
  }
}


/* Test build marker */
.test-mode-banner {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 2px solid #a451c7;
  border-radius: 16px;
  background: #f5eafb;
  color: #5e2476;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 8px 22px rgba(116, 61, 143, 0.12);
}
body::after {
  content: 'TEST';
  position: fixed;
  right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 120;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(94, 36, 118, 0.9);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  pointer-events: none;
}
@media print {
  .test-mode-banner, body::after { display: none !important; }
}
