:root {
  color: #17202a;
  background: #e8f0ee;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

.offline-status {
  position: fixed;
  right: 8px;
  bottom: calc(68px + env(safe-area-inset-bottom) + 4px);
  left: 8px;
  z-index: 6;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #e9c98d;
  border-radius: 6px;
  padding: 0 10px;
  background: rgba(255, 248, 228, .96);
  color: #795b19;
  font-size: 10px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(74, 57, 18, .12);
}

.offline-status:disabled { opacity: .8; }
.offline-status .spinning { animation: offline-reconnect-spin 800ms linear infinite; }

@keyframes offline-reconnect-spin {
  to { transform: rotate(360deg); }
}

html,
body,
#app {
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  overflow-y: hidden;
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  overscroll-behavior: none;
}

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

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(36, 119, 209, 0.28);
  outline-offset: 2px;
}

.app-shell {
  position: relative;
  width: min(100%, 480px);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  overflow: clip;
  overscroll-behavior: none;
  background: #f7faf9;
  box-shadow: 0 0 40px rgba(25, 53, 48, 0.14);
}

.ledger-content,
.stats-scroll,
.ledgers-scroll,
.me-scroll,
.entry-detail-scroll,
.settings-form {
  overscroll-behavior-y: contain;
}

.ledger-header {
  position: relative;
  z-index: 5;
  min-height: 180px;
  padding: max(18px, env(safe-area-inset-top)) 18px 20px;
  background: var(--ledger-gradient, #087f72);
  color: #ffffff;
}

.ledger-header::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 7px;
  background: linear-gradient(90deg, #ffc857 0 32%, #f46b45 32% 66%, #37a8d4 66%);
  content: "";
}

.top-actions {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 10px;
}

.ledger-header-actions { display:flex; align-items:center; gap:4px; }

.participant-avatars {
  width: 56px;
  height: 40px;
  display: flex;
  align-items: center;
  border: 0;
  padding: 0 2px;
  background: transparent;
}

.participant-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid var(--ledger-accent, #087f72);
  border-radius: 50%;
  color: #ffffff;
  font-size: 10px;
  font-weight: 760;
  box-shadow: 0 3px 8px rgba(15, 52, 46, 0.18);
}

.participant-avatar + .participant-avatar {
  margin-left: -9px;
}

.participant-avatar.owner,
.share-member-avatar.owner {
  background: #f05d3f;
}

.participant-avatar.member-wang,
.share-member-avatar.member-wang {
  background: #3478e5;
}

.participant-avatar.member,
.share-member-avatar.member {
  background: #3478e5;
}

.participant-avatar.member-li,
.share-member-avatar.member-li {
  background: #7559d9;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
}

.header-icon {
  background: rgba(255, 255, 255, 0.14);
}

.ledger-more-layer {
  position: absolute;
  inset: 0;
  z-index: 50;
}

.ledger-more-scrim {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

.ledger-more-menu {
  position: absolute;
  top: 52px;
  right: 14px;
  z-index: 51;
  width: 142px;
  overflow: hidden;
  border: 1px solid rgba(218, 232, 228, 0.92);
  border-radius: 8px;
  background: #ffffff;
  color: #26342f;
  box-shadow: 0 12px 28px rgba(20, 53, 46, 0.24);
}

.ledger-more-menu button {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid #e7efed;
  padding: 0 15px;
  background: #ffffff;
  color: #31504a;
  font-size: 14px;
  text-align: left;
}

.ledger-more-menu button:last-child {
  border-bottom: 0;
}

.ledger-more-menu button:active {
  background: #edf7f4;
}

.ledger-switcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: inherit;
}

.ledger-header-icon { width:26px; height:26px; display:grid; place-items:center; flex:0 0 auto; border-radius:7px; color:#fff; box-shadow:0 2px 6px rgba(20,45,40,.18); }

.ledger-switcher {
  min-width: 0;
  font-size: 19px;
  font-weight: 780;
}

.monthly-summary {
  display:block;
  min-width:0;
  margin-top: 22px;
  overflow:hidden;
}

.summary-values { display:grid; grid-template-columns:minmax(0,1fr) minmax(132px,.72fr); align-items:center; gap:18px; }
.summary-balance-label { min-width:0; display:flex; align-items:baseline; justify-content:flex-start; gap:8px; }
.summary-balance-label > span { min-width:52px; margin-bottom:0; line-height:1.2; }
.summary-currency-picker { min-width:0; max-width:calc(100% - 60px); display:flex; flex:0 1 auto; gap:3px; overflow-x:auto; scrollbar-width:none; }
.summary-currency-picker::-webkit-scrollbar { display:none; }
.summary-currency-picker button { flex:0 0 auto; border:0; border-radius:5px; padding:2px 6px 1px; background:transparent; color:rgba(255,255,255,.42); font-size:10px; line-height:1.2; font-variant-numeric:tabular-nums; }
.summary-currency-picker button.active { background:rgba(255,255,255,.2); color:#fff; font-weight:720; }
.summary-value-window { min-width:0; overflow:hidden; }
.summary-value-track { display:flex; width:calc(100% * var(--summary-slides)); transition:transform 260ms cubic-bezier(.22,.8,.25,1); }
.summary-value-track.dragging { transition:none; }
.summary-value-slide { flex:0 0 calc(100% / var(--summary-slides)); min-width:0; overflow:hidden; text-align:center; text-overflow:ellipsis; }
.summary-main .summary-value-slide { text-align:left; }
.summary-stat .summary-value-slide { text-align:right; }

.summary-main,
.summary-stat {
  min-width: 0;
}

.monthly-summary span,
.monthly-summary strong {
  display: block;
  white-space: nowrap;
}

.monthly-summary span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.summary-main span {
  margin-bottom: 4px;
}

.summary-main strong {
  overflow: hidden;
  font-size: 23px;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.summary-main strong.compact {
  font-size: 17px;
}

.summary-secondary {
  min-width: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
  padding-left: 12px;
}

.summary-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.summary-stat + .summary-stat {
  margin-top: 8px;
}

.summary-stat strong {
  overflow: hidden;
  font-size: 14px;
  text-align: right;
  text-overflow: ellipsis;
}

.summary-stat strong.compact {
  font-size: 10px;
}

.income-stat strong {
  color: #d9ffe7;
}

.expense-stat strong {
  color: #ffe6dc;
}

.summary-expense-slide {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.summary-expense-slide small {
  max-width: 100%;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
  line-height: 1.15;
  text-align: right;
  text-overflow: ellipsis;
}

.ledger-content {
  position: relative;
  height: calc(100vh - 180px);
  height: calc(100dvh - 180px);
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 112px;
  background: #f7faf9;
}

.list-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  touch-action: pan-y;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #dce8e4;
  background: #f7faf9;
  box-shadow: 0 2px 6px rgba(32, 57, 51, 0.04);
}

.list-toolbar-content {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transform: translateX(var(--month-swipe-offset, 0px));
  transition: transform 220ms cubic-bezier(.2,.8,.2,1);
}

.list-toolbar-content.dragging { transition: none; }
.month-swipe-hint { position:absolute; top:50%; left:50%; display:flex; align-items:center; gap:3px; transform:translate(-50%,-50%); border:1px solid #cfe0db; border-radius:999px; padding:4px 8px; background:rgba(255,255,255,.96); color:#087f72; box-shadow:0 4px 12px rgba(26,60,52,.12); font-size:11px; font-weight:700; pointer-events:none; }
.month-swipe-hint.next { color:#3478e5; }

.list-toolbar-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.sync-notice {
  height: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #efd9c9;
  padding: 3px 16px;
  background: #fff8f2;
  color: #8e481e;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(70, 43, 25, 0.1);
  pointer-events: auto;
}

.sync-notice > span,
.sync-notice button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sync-notice button {
  flex: 0 0 auto;
  min-height: 26px;
  border: 0;
  border-radius: 7px;
  padding: 0 9px;
  background: #f0e2d7;
  color: #7a3d1b;
  font-weight: 680;
}

.sync-notice button:disabled { opacity: .6; }
.sync-notice .spinning { animation: sync-spin .8s linear infinite; }
@keyframes sync-spin { to { transform: rotate(360deg); } }

.list-toolbar-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-month-switcher {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  padding: 0;
  background: transparent;
  color: #26342f;
}

.native-month-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.month-picker-layer { position:absolute; inset:0; z-index:16; }
.month-picker-scrim { position:absolute; inset:0; width:100%; height:100%; border:0; background:rgba(18,35,32,.4); backdrop-filter:blur(3px); }
.month-picker-modal { position:absolute; right:0; bottom:0; left:0; max-height:82%; overflow-y:auto; border-radius:14px 14px 0 0; padding:0 16px calc(18px + env(safe-area-inset-bottom)); background:#fff; color:#22302c; box-shadow:0 -16px 36px rgba(22,45,40,.22); }
.month-picker-modal > header { min-height:56px; display:grid; grid-template-columns:38px 1fr 38px; align-items:center; border-bottom:1px solid #e1ebe8; }
.month-picker-modal > header strong { text-align:center; font-size:16px; }
.month-picker-modal > header button { width:38px; height:38px; display:grid; place-items:center; border:0; border-radius:8px; background:#f0f5f3; color:#536762; }
.month-picker-year-nav { display:grid; grid-template-columns:38px repeat(3,minmax(0,1fr)) 38px; align-items:center; gap:2px; min-height:54px; }
.month-picker-year-nav > button { min-height:38px; display:grid; place-items:center; border:0; border-radius:8px; background:transparent; color:#82918c; font-size:15px; font-variant-numeric:tabular-nums; }
.month-picker-year-nav > button:not(:first-child):not(:last-child).selected { background:#eaf7f3; color:#087f72; font-weight:720; }
.month-picker-year-nav > button:disabled { cursor:default; opacity:.32; }
.month-picker-total { display:flex; justify-content:center; gap:18px; margin:-2px 0 14px; font-size:12px; font-variant-numeric:tabular-nums; }
.month-picker-total .income,.month-picker-grid .income { color:#0d8b67; }
.month-picker-total .expense,.month-picker-grid .expense { color:#d84c36; }
.month-picker-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.month-picker-grid button { min-height:68px; display:grid; align-content:center; gap:2px; border:1px solid #e1ebe8; border-radius:8px; padding:7px 5px; background:#fff; text-align:center; }
.month-picker-grid button:disabled { cursor:default; opacity:.42; }
.month-picker-grid button.selected { border-color:#087f72; background:#eaf7f3; box-shadow:inset 0 0 0 1px #087f72; }
.month-picker-grid button strong { color:#26342f; font-size:14px; }
.month-picker-grid button small { overflow:hidden; color:#7a8783; font-size:10px; line-height:1.2; text-overflow:ellipsis; white-space:nowrap; }
.year-picker-list { display:grid; gap:2px; padding-top:8px; }
.year-picker-list button { min-height:58px; display:flex; align-items:center; justify-content:space-between; border:0; border-bottom:1px solid #e5edeb; padding:0 8px; background:#fff; color:#26342f; text-align:left; }
.year-picker-list button.selected { color:#087f72; }
.year-picker-list button strong { font-size:16px; }
.year-picker-list button span { display:flex; gap:10px; font-size:11px; font-variant-numeric:tabular-nums; }
.year-picker-list button i { font-style:normal; }
.month-picker-enter-active,.month-picker-leave-active { transition:opacity 180ms ease; }
.month-picker-enter-active .month-picker-modal,.month-picker-leave-active .month-picker-modal { transition:transform 220ms ease; }
.month-picker-enter-from,.month-picker-leave-to { opacity:0; }
.month-picker-enter-from .month-picker-modal,.month-picker-leave-to .month-picker-modal { transform:translateY(100%); }

.list-toolbar strong {
  font-size: 15px;
}

.list-toolbar span {
  color: #75817e;
  font-size: 12px;
}

.list-toolbar-totals {
  min-width: 0;
  display: flex;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.list-toolbar-totals span {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-toolbar-totals .income,
.day-summary .income {
  color: #0d8b67;
}

.list-toolbar-totals .expense,
.day-summary .expense {
  color: #d84c36;
}

.list-filter-action { display:flex; align-items:center; gap:3px; flex:0 0 auto; }
.list-action {
  width: 36px;
  height: 36px;
  color: #41605a;
}

.list-action.active { color:#087f72; background:#e5f5f0; }
.active-filter-count { color:#087f72!important; font-size:10px!important; font-weight:720; white-space:nowrap; }
.filter-layer { z-index:17; }
.filter-modal { max-height:88%; }
.filter-keyword-field { display:grid; gap:6px; border-bottom:1px solid #e1ebe8; padding:14px 0; }
.filter-keyword-field > span,.filter-category-heading strong { color:#7b8884; font-size:11px; }
.filter-keyword-field input { width:100%; min-height:40px; border:1px solid #d2dfdc; border-radius:8px; padding:0 10px; outline:0; background:#f8fbfa; color:#26342f; font-size:14px; }
.filter-category-heading { display:flex; align-items:center; justify-content:space-between; padding:14px 0 8px; }
.filter-category-heading button { border:0; padding:3px 0; background:transparent; color:#087f72; font-size:11px; }
.filter-category-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
.filter-category-option { min-height:42px; display:flex; align-items:center; justify-content:space-between; gap:5px; border:1px solid #e1ebe8; border-radius:8px; padding:0 9px; background:#fff; color:#344640; text-align:left; }
.filter-category-option.child { min-height:36px; padding-left:7px; color:#60716c; font-size:12px; }
.filter-category-option.selected { border-color:#087f72; background:#eaf7f3; color:#087f72; box-shadow:inset 0 0 0 1px #087f72; font-weight:720; }
.filter-category-option small { color:inherit; font-size:10px; font-weight:500; }
.filter-done { width:100%; min-height:44px; margin-top:16px; border:0; border-radius:8px; background:#087f72; color:#fff; font-weight:720; }

.day-group {
  padding-top: 14px;
}

.day-group-heading {
  min-height: 23px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.day-group h2 {
  margin: 0 0 5px;
  color: #64726f;
  font-size: 12px;
  font-weight: 680;
}

.day-summary {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.entry-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 66px;
  border-bottom: 1px solid #e2ebe8;
  color: inherit;
  text-decoration: none;
}

.entry-category-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
}

.entry-copy,
.entry-value {
  min-width: 0;
}

.entry-copy strong,
.entry-copy span,
.entry-value strong,
.entry-value span {
  display: block;
}

.entry-copy strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-subline {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
}

.entry-copy .entry-recorder {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 3px;
  color: #3478e5;
  font-weight: 650;
}

.entry-copy .entry-category-label {
  min-width: 0;
  overflow: hidden;
  color: #7b8683;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-copy .entry-sync-pending {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  color: #b35a24;
}

.entry-copy .entry-category-label::before {
  margin-right: 7px;
  color: #c4cecb;
  content: "·";
}

.entry-copy span,
.entry-value span {
  margin-top: 2px;
  color: #7b8683;
  font-size: 12px;
}

.entry-value {
  text-align: right;
}

.entry-value strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.entry-value .entry-original-amount {
  margin: 0 0 1px;
  color: #9aaaa5;
  font-size: 11px;
  line-height: 1.05;
  text-decoration: line-through;
  font-variant-numeric: tabular-nums;
}

.entry-value .expense {
  color: #d84c36;
}

.entry-value .income {
  color: #0d8b67;
}

.entry-reimbursement-value {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.entry-value .entry-reimbursement-tag {
  display: inline-block;
  margin: 0;
  padding: 1px 4px;
  border: 1px solid #c5d6ea;
  border-radius: 3px;
  color: #5e7895;
  font-size: 9px;
  line-height: 1.25;
  white-space: nowrap;
}

.entry-value .reimbursement {
  color: #3478b8;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: #78a5cc;
}

.empty-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  color: #7b8683;
}

.empty-state strong {
  color: #374541;
}

.empty-state span {
  font-size: 13px;
}

.load-more-sentinel {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #71807c;
  font-size: 12px;
}

.load-more-sentinel svg {
  animation: load-more-spin 900ms linear infinite;
}

@keyframes load-more-spin {
  to { transform: rotate(360deg); }
}

.bottom-nav {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 4;
  height: calc(68px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: start;
  border-top: 1px solid #d8e5e1;
  padding: 7px 8px env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.bottom-nav a {
  min-width: 0;
  height: 50px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 0;
  background: transparent;
  color: #84908d;
  text-decoration: none;
}

.bottom-nav a.active {
  color: #087f72;
}

.bottom-nav span {
  font-size: 10px;
}

.add-entry-button {
  position: absolute;
  right: 50%;
  bottom: calc(31px + env(safe-area-inset-bottom));
  z-index: 5;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  transform: translate(50%, 50%);
  border: 5px solid #ffffff;
  border-radius: 50%;
  background: #f05d3f;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(202, 66, 40, 0.28);
}

.drawer-scrim {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(18, 35, 32, 0.36);
  backdrop-filter: blur(1px);
  transition: opacity 220ms ease;
}

.drawer-scrim:not(.drawer-entered) { opacity: 0; }
.drawer-scrim.drawer-closing { opacity: 0; }

.drawer-scrim.category-mode {
  background: rgba(18, 35, 32, 0.42);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.quick-drawer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 11;
  border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  background: #ffffff;
  box-shadow: 0 -16px 36px rgba(22, 45, 40, 0.22);
  transition: transform 220ms ease;
}

.quick-drawer.drawer-dragging { transition: none; }
.quick-drawer:not(.drawer-entered):not(.drawer-closing) { transform: translateY(100%); }
.quick-drawer.drawer-closing { transform: translateY(100%); }

.drawer-handle {
  width: 38px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 2px;
  background: #b9cac5;
  cursor: grab;
  touch-action: none;
}

.drawer-handle:active { cursor: grabbing; }

.drawer-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px 5px 18px;
}

.drawer-header.long-amount {
  flex-wrap: wrap;
  row-gap: 2px;
}

.drawer-header.long-amount .amount-block,
.drawer-header.long-amount .amount-result {
  width: 100%;
}

.drawer-header.long-amount .quick-ledger-target {
  margin-left: auto;
}

.amount-block {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.quick-ledger-target {
  position: relative;
  width: max-content;
  max-width: min(190px, 48vw);
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  border-radius: 6px;
  padding: 0 8px;
  background: #eaf6f3;
  color: #087f72;
  font-size: 11px;
  font-weight: 680;
  border: 0;
}

.quick-ledger-target span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-ledger-picker-layer { position:absolute; inset:0; z-index:30; }
.quick-ledger-picker-scrim { position:absolute; inset:0; width:100%; height:100%; border:0; background:rgba(18,35,32,.42); backdrop-filter:blur(2px); }
.quick-ledger-picker { position:absolute; right:0; bottom:0; left:0; max-height:90%; overflow-y:auto; border-radius:14px 14px 0 0; padding:0 16px calc(16px + env(safe-area-inset-bottom)); background:#fff; color:#26342f; }
.quick-ledger-picker-handle { width:38px; height:4px; margin:8px auto 3px; border-radius:2px; background:#b9cac5; }
.quick-ledger-picker > header { min-height:56px; display:flex; align-items:center; justify-content:space-between; }
.quick-ledger-picker > header > div { display:grid; gap:1px; }
.quick-ledger-picker > header strong { font-size:16px; }
.quick-ledger-picker > header span { color:#7b8884; font-size:11px; }
.quick-ledger-picker > header > button { width:36px; height:36px; display:grid; place-items:center; border:0; border-radius:8px; background:#f0f5f3; color:#536762; }
.quick-ledger-options { border-top:1px solid #e1ebe8; border-bottom:1px solid #e1ebe8; }
.quick-ledger-options > button { width:100%; min-height:54px; display:grid; grid-template-columns:36px minmax(0,1fr) 24px; align-items:center; gap:10px; border:0; border-bottom:1px solid #edf2f0; padding:7px 2px; background:#fff; color:#26342f; text-align:left; }
.quick-ledger-options > button:last-child { border-bottom:0; }
.quick-ledger-options > button > span { width:34px; height:34px; display:grid; place-items:center; border-radius:8px; color:#fff; }
.quick-ledger-options > button > strong { overflow:hidden; font-size:14px; text-overflow:ellipsis; white-space:nowrap; }
.quick-ledger-options > button > strong small { margin-left:8px; color:#82908c; font-size:11px; font-weight:500; }
.quick-ledger-options > button > svg { color:#087f72; }
.quick-ledger-options > button.automatic { cursor:default; opacity:.62; }
.quick-ledger-picker-done { width:100%; height:46px; display:flex; align-items:center; justify-content:center; gap:6px; margin-top:14px; border:0; border-radius:8px; background:#087f72; color:#fff; font-weight:720; }

.amount-result {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.amount-prefix {
  min-width: 30px;
  border: 0;
  border-bottom: 1px dashed #9baba6;
  padding: 0 2px 1px;
  background: transparent;
  color: #70807c;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.1;
}

.ledger-notice-slot { position:absolute; top:0; right:0; left:0; z-index:4; height:0; overflow:visible; pointer-events:none; }
.conversion-notice { height:32px; display:flex; align-items:center; justify-content:space-between; gap:8px; border-bottom:1px solid #eadfca; padding:4px 12px; background:#fff9ed; color:#775b24; font-size:11px; box-shadow:0 2px 8px rgba(58,43,17,.08); pointer-events:auto; }
.ledger-pull-space { display:flex; align-items:center; justify-content:center; gap:5px; flex:0 0 auto; color:#7d8c88; font-size:11px; opacity:var(--pull-progress); pointer-events:none; overflow:hidden; }
.ledger-pull-space.top { margin:0 -16px; }
.ledger-pull-space.bottom { margin:0 -16px; }
.ledger-pull-space.refresh { color:#087f72; }
.ledger-pull-space.previous { color:#b05f22; }
.ledger-pull-space.next { color:#3478e5; }
.conversion-notice span { display:flex; align-items:center; gap:6px; }
.conversion-notice button { display:inline-flex; align-items:center; gap:4px; flex:0 0 auto; min-height:25px; border:0; border-radius:7px; padding:0 8px; background:#f0e2c9; color:#76521d; font-size:11px; font-weight:680; }
.conversion-notice button:disabled { opacity:.6; }
.conversion-notice .spinning { animation: sync-spin .8s linear infinite; }

.amount-value {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  color: #172421;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.amount-normal { font-size: 44px; }
.amount-compact { font-size: 38px; }
.amount-small { font-size: 32px; }
.amount-tiny { font-size: 27px; }

.amount-result.amount-normal .amount-value { font-size: 44px; }
.amount-result.amount-compact .amount-value { font-size: 38px; }
.amount-result.amount-small .amount-value { font-size: 32px; }
.amount-result.amount-tiny .amount-value { font-size: 27px; }

.calculation-line {
  max-width: min(72vw, 330px);
  overflow: hidden;
  color: #75817e;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-meta-row {
  height: 56px;
  display: grid;
  grid-template-columns: minmax(64px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  border-top: 1px solid #e4ece9;
  padding: 3px 16px 5px;
}

.header-date-button {
  flex: 0 0 auto;
  min-width: max-content;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #f3cf78;
  border-radius: 8px;
  padding: 0 9px;
  background: #fff8df;
  color: #8a620d;
  font-size: 12px;
  font-weight: 680;
  white-space: nowrap;
}

.header-date-button.invalid {
  border-color: #e9a79c;
  background: #fff2ef;
  color: #c94635;
}

.native-date-input {
  position: absolute;
  right: 14px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.note-field {
  min-width: 0;
  display: block;
}

.note-field input {
  width: 100%;
  height: 32px;
  border: 0;
  border-bottom: 1px solid #dce8e4;
  border-radius: 0;
  padding: 0 3px;
  background: transparent;
  color: #27332f;
  /* iOS Safari auto-zooms editable controls below 16px when focused. */
  font-size: 16px;
}

.note-field input::placeholder {
  color: #9aa6a3;
}

.note-field.editing input {
  border-bottom-color: #78bdb2;
}

.keypad {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, 58px);
  border-top: 1px solid #dbe7e3;
  isolation: isolate;
}

.key {
  min-width: 0;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-right: 1px solid #e2ebe8;
  border-bottom: 1px solid #e2ebe8;
  background: #ffffff;
  color: #26332f;
}

.key:nth-last-child(-n + 4) {
  border-bottom: 0;
}

.number-key {
  font-size: 22px;
  font-weight: 560;
}

.operator-key,
.utility-key {
  background: #f1f6f4;
  color: #3f5c55;
  font-size: 23px;
}

.operator-key.active {
  background: #fff3cd;
  color: #9b6700;
}

.category-selector-anchor {
  position: relative;
  z-index: 3;
  min-width: 0;
}

.meta-category-button {
  position: relative;
  z-index: 3;
  max-width: 120px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--category-color) 30%, white);
  border-radius: 8px;
  padding: 0 9px;
  background: color-mix(in srgb, var(--category-color) 11%, white);
  color: var(--category-color);
  font-size: 12px;
  font-weight: 750;
}

.category-selector-anchor.selector-open {
  z-index: 7;
}

.meta-category-button.active {
  z-index: 7;
  width: 72px;
  min-width: 72px;
  height: 72px;
  min-height: 72px;
  flex-direction: column;
  gap: 0;
  border: 1px solid color-mix(in srgb, var(--category-color) 35%, white);
  border-radius: 10px;
  padding: 0;
  background: color-mix(in srgb, var(--category-color) 13%, white);
  box-shadow: 0 10px 24px rgba(29, 57, 50, 0.22);
  isolation: isolate;
  visibility: hidden;
  pointer-events: none;
}

.meta-category-button.active > * {
  position: relative;
  z-index: 2;
}

.meta-category-button.active span {
  font-size: 13px;
  line-height: 1.1;
}

.meta-category-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-key {
  grid-column: 4;
  grid-row: 3 / span 2;
  border-right: 0;
  background: #f05d3f;
  color: #ffffff;
}

.save-key:disabled {
  background: #d8e1de;
  color: #8a9894;
}

.category-focus-scrim {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgba(19, 38, 34, 0.24);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.category-wheel-selector {
  --wheel-size: clamp(286px, 88vw, 344px);
  --center-size: clamp(72px, 20vw, 78px);
  --option-size: clamp(54px, 14.5vw, 58px);
  --option-gap: clamp(29px, 8vw, 33px);
  --option-radius: calc((var(--center-size) + var(--option-size)) / 2 + var(--option-gap));
  position: absolute;
  top: 0;
  right: 0;
  z-index: 6;
  width: 72px;
  height: 72px;
  overflow: visible;
  pointer-events: none;
}

.wheel-level-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.category-wheel-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--wheel-size);
  height: var(--wheel-size);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  touch-action: none;
  user-select: none;
  cursor: grab;
  pointer-events: auto;
}

.category-wheel-stage.dragging {
  cursor: grabbing;
}

.category-wheel-rotor {
  position: absolute;
  inset: 0;
  transform: rotate(var(--wheel-rotation));
  transform-origin: center;
  animation: wheel-level-reveal 220ms cubic-bezier(0.22, 0.8, 0.28, 1);
  will-change: transform;
}

.wheel-option {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--option-size);
  height: var(--option-size);
  display: grid;
  place-items: center;
  transform:
    translate(-50%, -50%)
    rotate(var(--option-angle))
    translateY(calc(0px - var(--option-radius)));
  border: 1px solid var(--option-border-color);
  border-radius: 50%;
  padding: 0;
  background: var(--option-color);
  box-shadow: 0 7px 16px rgba(27, 49, 44, 0.22);
  color: #ffffff;
  font-size: 11px;
  line-height: 1;
  font-weight: 760;
  text-shadow: 0 1px 3px rgba(19, 35, 31, 0.3);
  white-space: nowrap;
  pointer-events: auto;
  transition: border-color 140ms ease, box-shadow 140ms ease, scale 140ms ease;
}

.wheel-option-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transform: rotate(calc(0deg - var(--option-angle) - var(--wheel-rotation)));
  animation: wheel-option-reveal 240ms cubic-bezier(0.22, 0.8, 0.28, 1) both;
  animation-delay: calc(var(--option-index) * 16ms);
  will-change: transform;
}

.wheel-option:active {
  scale: 0.92;
}

.wheel-option.other-option {
  border-color: #cbd6d2;
  background: #ffffff;
  color: #25332f;
  text-shadow: none;
}

.wheel-option-label {
  max-width: calc(var(--option-size) - 10px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.wheel-option.selected {
  z-index: 1;
  border: 3px solid rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.24),
    0 9px 20px rgba(27, 49, 44, 0.26);
  scale: 1.06;
  animation: wheel-selection-pop 320ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

.wheel-option.selected:active {
  scale: 1.02;
}

.wheel-center-controls {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: var(--center-size);
  height: var(--center-size);
  display: grid;
  transform: translate(-50%, -50%);
  overflow: hidden;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(29, 55, 48, 0.22);
  animation: wheel-controls-reveal 180ms ease-out;
  pointer-events: auto;
}

.wheel-center-controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  padding: 0;
  font-size: 12px;
  font-weight: 740;
  transition: filter 120ms ease, transform 120ms ease;
}

.wheel-center-controls button:not(:disabled):active {
  filter: brightness(0.94);
  transform: scale(0.97);
}

.wheel-back {
  background: #eef3f1;
  color: #52635e;
}

@keyframes wheel-level-reveal {
  from {
    opacity: 0.35;
    scale: 0.96;
  }

  to {
    opacity: 1;
    scale: 1;
  }
}

@keyframes wheel-option-reveal {
  from {
    opacity: 0;
    scale: 0.9;
  }

  to {
    opacity: 1;
    scale: 1;
  }
}

@keyframes wheel-selection-pop {
  from {
    opacity: 0;
    scale: 0.72;
  }

  to {
    opacity: 1;
    scale: 1.06;
  }
}

@keyframes wheel-controls-reveal {
  from {
    opacity: 0;
    scale: 0.94;
  }

  to {
    opacity: 1;
    scale: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .category-wheel-rotor,
  .wheel-option-content,
  .wheel-option.selected,
  .wheel-center-controls {
    animation: none;
  }

  .wheel-option,
  .wheel-center-controls button {
    transition: none;
  }
}

.share-sheet-layer {
  position: absolute;
  inset: 0;
  z-index: 16;
}

.share-sheet-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(18, 35, 32, 0.4);
  backdrop-filter: blur(3px);
}

.ledger-share-sheet {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  border-radius: 14px 14px 0 0;
  padding: 0 16px calc(18px + env(safe-area-inset-bottom));
  background: #ffffff;
  color: #22302c;
  box-shadow: 0 -16px 36px rgba(22, 45, 40, 0.22);
}

.share-sheet-handle {
  width: 38px;
  height: 4px;
  margin: 8px auto 3px;
  border-radius: 2px;
  background: #b9cac5;
}

.ledger-share-sheet > header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ledger-share-sheet > header > div {
  display: grid;
  gap: 1px;
}

.ledger-share-sheet > header strong {
  font-size: 16px;
}

.ledger-share-sheet > header span {
  color: #7a8783;
  font-size: 11px;
}

.ledger-share-sheet > header button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #f0f5f3;
  color: #536762;
}

.share-member-list {
  border-top: 1px solid #e1ebe8;
  border-bottom: 1px solid #e1ebe8;
}

.share-member-row {
  min-height: 54px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #edf2f0;
}

.share-member-row:last-child {
  border-bottom: 0;
}

.share-member-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  font-size: 12px;
  font-weight: 760;
}

.share-member-row > span:last-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.share-member-row strong {
  font-size: 14px;
}

.share-member-row small {
  color: #7b8884;
  font-size: 11px;
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 10px;
  margin-top: 14px;
}

.share-actions button {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
}

.copy-invite-action {
  border: 1px solid #cbdad6;
  background: #ffffff;
  color: #48605a;
}

.system-share-action {
  border: 0;
  background: #087f72;
  color: #ffffff;
}

.share-feedback {
  min-height: 18px;
  margin: 8px 0 0;
  color: #7b8884;
  text-align: center;
  font-size: 11px;
}

.participant-sheet {
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.compact-share-sheet {
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}


.saved-toast {
  position: absolute;
  right: 50%;
  bottom: 92px;
  z-index: 20;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transform: translateX(50%);
  border-radius: 8px;
  padding: 0 14px;
  background: #173c35;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(21, 50, 44, 0.2);
  font-size: 13px;
  white-space: nowrap;
}

.drawer-enter-active,
.drawer-leave-active {
  transition: opacity 180ms ease;
}

.drawer-enter-active .quick-drawer,
.drawer-leave-active .quick-drawer {
  transition: transform 220ms ease;
}

.drawer-enter-from,
.drawer-leave-to {
  opacity: 0;
}

.drawer-enter-from .quick-drawer,
.drawer-leave-to .quick-drawer {
  transform: translateY(100%);
}

.coordinate-selector-enter-active,
.coordinate-selector-leave-active {
  transform-origin: 100% 0;
  transition: opacity 130ms ease, transform 170ms ease;
}

.coordinate-selector-enter-from,
.coordinate-selector-leave-to {
  opacity: 0;
  transform: scale(0.94);
}

.toast-enter-active,
.toast-leave-active {
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast-enter-from,
.toast-leave-to {
  opacity: 0;
  transform: translate(50%, 8px);
}

.share-sheet-enter-active,
.share-sheet-leave-active {
  transition: opacity 180ms ease;
}

.share-sheet-enter-active .ledger-share-sheet,
.share-sheet-leave-active .ledger-share-sheet {
  transition: transform 220ms ease;
}

.share-sheet-enter-from,
.share-sheet-leave-to {
  opacity: 0;
}

.share-sheet-enter-from .ledger-share-sheet,
.share-sheet-leave-to .ledger-share-sheet {
  transform: translateY(100%);
}

.more-menu-enter-active,
.more-menu-leave-active {
  transition: opacity 120ms ease;
}

.more-menu-enter-from,
.more-menu-leave-to {
  opacity: 0;
}

@media (max-width: 360px) {
  .ledger-header {
    padding-right: 14px;
    padding-left: 14px;
  }

  .monthly-summary {
    display:block;
  }

  .summary-main strong {
    font-size: 20px;
  }

  .summary-secondary {
    padding-left: 8px;
  }

  .entry-meta-row {
    grid-template-columns: minmax(54px, 1fr) auto auto;
    gap: 5px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .meta-category-button {
    max-width: 92px;
  }

  .header-date-button {
    padding: 0 6px;
  }

  .quick-ledger-target {
    max-width: 46vw;
    padding: 0 7px;
  }

  .ledger-content {
    padding-right: 12px;
    padding-left: 12px;
  }

  .day-summary {
    gap: 7px;
    font-size: 10px;
  }

  .list-toolbar-totals {
    gap: 7px;
  }
}

@media (min-width: 700px) {
  body {
    padding: 16px 0;
  }

  .app-shell {
    height: calc(100vh - 32px);
    min-height: 620px;
    border-radius: 18px;
  }

  .ledger-content {
    height: calc(100% - 210px);
    min-height: 0;
  }

  .bottom-nav,
  .quick-drawer,
  .drawer-scrim {
    position: absolute;
  }
}
