:root {
  color-scheme: light;
  --bg: #f7f7f7;
  --surface: #ffffff;
  --surface-subtle: #f7f7f7;
  --surface-coral: #fff1f3;
  --ink: #222222;
  --ink-soft: #484848;
  --muted: #717171;
  --muted-light: #b0b0b0;
  --line: #dddddd;
  --line-soft: #ebebeb;
  --coral: #ff385c;
  --coral-deep: #e31c5f;
  --coral-dark: #c13552;
  --coral-soft: #fff0f2;
  --success: #008a70;
  --success-soft: #e6f6f2;
  --kiju: #4e9be7;
  --myeongji: #ee7890;
  --radius-xs: 10px;
  --radius-sm: 13px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --selector-height: 36px;
  --selector-radius: var(--radius-pill);
  --bottom-nav-height: 66px;
  --bottom-nav-offset: calc(8px + env(safe-area-inset-bottom));
  --bottom-nav-clearance: calc(var(--bottom-nav-height) + var(--bottom-nav-offset) + 32px);
  font-family: "Airbnb Cereal", Circular, Pretendard, "Apple SD Gothic Neo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-sheet-open {
  overflow: hidden;
}

body.is-dialog-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

svg {
  display: block;
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

[hidden] {
  display: none !important;
}

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

.ambient {
  display: none;
}

.glass-card,
.glass-control {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* identity */

.identity-screen {
  display: grid;
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  place-items: center;
  background: #fff;
}

.identity-card {
  width: min(100%, 410px);
  padding: 20px 0;
  border: 0;
  box-shadow: none;
  text-align: center;
}

.identity-symbol,
.brand-mark {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--coral);
}

.identity-symbol {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border-radius: 17px;
  box-shadow: 0 7px 16px rgba(227, 28, 95, 0.22);
  font-size: 1.15rem;
  font-weight: 900;
}

.eyebrow,
.sheet-kicker {
  margin: 0;
  color: var(--coral-deep);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.07em;
}

.identity-card h1 {
  margin: 6px 0 9px;
  color: var(--ink);
  font-size: clamp(1.9rem, 9vw, 2.5rem);
  line-height: 1.08;
  letter-spacing: -0.065em;
}

.identity-description {
  margin: 0 10px 25px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.user-choices {
  display: grid;
  gap: 10px;
}

.user-choice {
  display: grid;
  min-height: 67px;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  text-align: left;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.user-choice:hover,
.user-choice:focus-visible {
  outline: none;
  border-color: #bdbdbd;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.choice-copy strong,
.choice-copy small {
  display: block;
}

.choice-copy strong {
  margin-bottom: 2px;
  font-size: 0.91rem;
}

.choice-copy small,
.identity-hint {
  color: var(--muted);
  font-size: 0.7rem;
}

.choice-arrow {
  color: var(--coral);
  font-size: 1.55rem;
  line-height: 1;
}

.identity-hint {
  margin: 15px 0 0;
}

.avatar {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
  font-size: 0.77rem;
  font-weight: 820;
}

.avatar-kiju {
  background: var(--kiju);
}

.avatar-myeongji {
  background: var(--myeongji);
}

.avatar-small {
  width: 28px;
  height: 28px;
  border-width: 1px;
  font-size: 0.61rem;
}

/* shell */

.workspace {
  width: min(100%, 720px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 16px var(--bottom-nav-clearance);
  scroll-padding-bottom: var(--bottom-nav-clearance);
}

.app-header {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}

.header-brand,
.header-actions,
.presence-stack,
.connection-status,
.profile-button {
  display: flex;
  align-items: center;
}

.header-brand {
  min-width: 0;
  gap: 8px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 0.7rem;
}

.header-brand h1 {
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.055em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  flex: 0 0 auto;
  gap: 6px;
}

.connection-status {
  gap: 4px;
  color: var(--muted);
  font-size: 0.61rem;
  white-space: nowrap;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b0b0b0;
}

.connection-dot.is-online {
  background: #00a699;
}

.connection-dot.is-error {
  background: var(--coral);
}

.presence-stack {
  padding-left: 3px;
}

.presence-stack .avatar {
  width: 24px;
  height: 24px;
  margin-left: -5px;
  border-width: 1px;
  font-size: 0.52rem;
}

.profile-button {
  min-height: 32px;
  gap: 5px;
  padding: 2px 7px 2px 3px;
  border-radius: var(--radius-pill);
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 760;
}

.profile-chevron {
  color: var(--muted);
  font-size: 0.83rem;
}

.tab-panel.is-active {
  animation: panel-in 180ms ease both;
}

.panel-toolbar {
  display: grid;
  min-height: 46px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  margin: 8px 0 10px;
}

.panel-toolbar h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.18rem;
  font-weight: 820;
  letter-spacing: -0.065em;
}

.panel-toolbar p {
  overflow: hidden;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-bubble {
  display: inline-flex;
  max-width: 120px;
  min-height: 26px;
  align-items: center;
  gap: 4px;
  padding: 3px 7px 3px 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #fff;
  font-size: 0.57rem;
  font-weight: 680;
}

.editor-bubble .avatar {
  width: 18px;
  height: 18px;
  font-size: 0.44rem;
}

.feature-button,
.primary-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 11px;
  border-radius: var(--radius-xs);
  color: #fff;
  background: var(--coral);
  box-shadow: 0 2px 4px rgba(227, 28, 95, 0.16);
  font-size: 0.66rem;
  font-weight: 790;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.feature-button:hover,
.feature-button:focus-visible,
.primary-button:hover,
.primary-button:focus-visible {
  outline: none;
  background: var(--coral-deep);
  box-shadow: 0 4px 10px rgba(227, 28, 95, 0.2);
  transform: translateY(-1px);
}

.feature-button > span:first-child,
.primary-button > span:first-child {
  font-size: 0.89rem;
  font-weight: 500;
}

.save-button,
.save-primary,
.buy-button,
.buy-primary {
  background: var(--coral);
}

/* shared collapse */

.collapsible-section {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.035);
}

.collapse-heading {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px 8px 14px;
}

.collapse-heading > div:first-child {
  min-width: 0;
}

.collapse-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 790;
  letter-spacing: -0.045em;
}

.collapse-heading p {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.6rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collapse-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.section-count {
  color: var(--muted);
  font-size: 0.59rem;
  font-weight: 680;
}

.section-disclosure {
  display: inline-flex;
  min-height: 40px;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  padding: 0 5px 0 8px;
  border-radius: var(--radius-xs);
  color: var(--ink-soft);
  background: transparent;
  font-size: 0.61rem;
  font-weight: 710;
}

.section-disclosure:hover,
.section-disclosure:focus-visible {
  outline: none;
  color: var(--coral-deep);
  background: var(--surface-coral);
}

.disclosure-icon {
  width: 20px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  text-align: center;
  transition: transform 160ms ease;
}

.collapsible-section.is-open .disclosure-icon {
  transform: rotate(180deg);
}

.collapse-content {
  padding: 11px 13px 13px;
  border-top: 1px solid var(--line-soft);
}

/* shopping */

.shopping-summary {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
}

.shopping-summary > div:first-child {
  min-width: 0;
}

.shopping-summary p,
.shopping-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.63rem;
}

.shopping-summary p {
  margin: 0 0 3px;
}

.shopping-summary > div > strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(1.42rem, 6.6vw, 1.72rem);
  font-weight: 830;
  letter-spacing: -0.075em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopping-summary > div > strong + span {
  margin-top: 4px;
  font-size: 0.58rem;
}

.shopping-summary-side {
  display: grid;
  width: 60px;
  height: 60px;
  flex: 0 0 auto;
  place-items: center;
  align-content: center;
  border-radius: 14px;
  background: var(--surface-coral);
}

.summary-icon {
  margin-bottom: -1px;
  color: var(--coral);
  font-size: 1.05rem !important;
  line-height: 0.8;
}

.shopping-summary-side strong {
  color: var(--coral-deep);
  font-size: 0.76rem;
  letter-spacing: -0.04em;
}

.shopping-summary-side span:last-child {
  margin-top: 1px;
  color: var(--coral-dark) !important;
  font-size: 0.49rem !important;
}

.chart-detail-heading,
.list-toolbar {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chart-detail-heading > p,
.list-toolbar > p {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 0.61rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.year-switcher {
  display: grid;
  min-height: 32px;
  grid-template-columns: 27px auto 27px;
  align-items: center;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: #fff;
}

.year-arrow {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-soft);
  background: transparent;
  font-size: 1.15rem;
  line-height: 1;
}

.year-arrow:hover,
.year-arrow:focus-visible {
  outline: none;
  color: var(--ink);
  background: var(--surface-subtle);
}

.year-select {
  min-width: 57px;
}

.year-select select {
  width: 100%;
  padding: 0 4px;
  border: 0;
  color: var(--ink-soft);
  outline: 0;
  background: transparent;
  font-size: 0.64rem;
  font-weight: 750;
  text-align: center;
}

.chart-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.chart-kpis > div {
  min-width: 0;
  padding: 8px 9px;
  border-radius: var(--radius-xs);
  background: var(--surface-subtle);
}

.chart-kpis span,
.chart-kpis strong {
  display: block;
}

.chart-kpis span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.55rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-kpis strong {
  overflow: hidden;
  margin-top: 3px;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 790;
  letter-spacing: -0.05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopping-month-chart {
  display: grid;
  height: 118px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 3px;
  margin-top: 10px;
}

.month-bar {
  display: grid;
  min-width: 0;
  grid-template-rows: 14px 1fr 15px;
  align-items: end;
  padding: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
}

.month-bar:hover,
.month-bar:focus-visible {
  outline: none;
  color: var(--ink);
}

.month-bar-value {
  overflow: hidden;
  padding: 0 1px;
  color: transparent;
  font-size: 0.45rem;
  font-weight: 740;
  letter-spacing: -0.06em;
  text-align: center;
  text-overflow: clip;
  white-space: nowrap;
}

.month-bar.is-selected .month-bar-value {
  color: var(--coral-deep);
}

.month-bar-track {
  position: relative;
  display: block;
  height: 100%;
  margin: 0 1px;
  overflow: hidden;
  border-radius: 5px;
  background: #f0f0f0;
}

.month-bar-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  min-height: 3px;
  border-radius: inherit;
  background: var(--coral);
  transition: height 240ms ease;
}

.month-bar:not(.has-value) .month-bar-fill {
  background: #e7e7e7;
}

.month-bar.is-selected .month-bar-track {
  outline: 1px solid var(--coral);
  outline-offset: 1px;
}

.month-bar-label {
  overflow: hidden;
  padding-top: 4px;
  font-size: 0.48rem;
  font-weight: 690;
  letter-spacing: -0.05em;
  text-align: center;
  text-overflow: clip;
  white-space: nowrap;
}

.month-bar.is-selected .month-bar-label {
  color: var(--coral-deep);
  font-weight: 790;
}

.chart-hint {
  margin: 6px 1px 0;
  color: var(--muted);
  font-size: 0.56rem;
  line-height: 1.4;
}

.segmented-control {
  display: inline-grid;
  min-height: 31px;
  grid-template-columns: repeat(2, auto);
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
}

.segment-button {
  min-height: 25px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  background: transparent;
  font-size: 0.57rem;
  font-weight: 710;
}

.segment-button.is-active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.shopping-list,
.savings-entry-list {
  overflow: hidden;
  margin-top: 9px;
  border-top: 1px solid var(--line-soft);
}

.shopping-item {
  display: grid;
  min-height: 62px;
  grid-template-columns: 34px minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 8px;
  padding: 8px 1px;
  border-top: 1px solid var(--line-soft);
}

.shopping-item:first-child,
.savings-entry:first-child {
  border-top: 0;
}

.purchase-toggle {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1.5px solid #b0b0b0;
  border-radius: 50%;
  color: transparent;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 900;
}

.purchase-toggle:hover,
.purchase-toggle:focus-visible {
  outline: none;
  border-color: var(--coral);
  background: var(--surface-coral);
}

.shopping-item.is-completed .purchase-toggle {
  border-color: var(--coral);
  color: #fff;
  background: var(--coral);
}

.shopping-item-copy,
.savings-entry-copy {
  min-width: 0;
}

.shopping-item-copy strong,
.shopping-item-copy span,
.savings-entry-copy strong,
.savings-entry-copy span {
  display: block;
}

.shopping-item-copy strong,
.savings-entry-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 740;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopping-item-copy span,
.savings-entry-copy span {
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.56rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopping-item.is-completed .shopping-item-copy strong {
  color: var(--muted);
}

.shopping-item-price {
  max-width: 86px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.67rem;
  font-weight: 780;
  letter-spacing: -0.05em;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopping-item.is-completed .shopping-item-price {
  color: var(--coral-deep);
}

.item-action {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-size: 0.82rem;
  line-height: 1;
}

.item-action:hover,
.item-action:focus-visible {
  outline: none;
  color: var(--ink);
  background: var(--surface-subtle);
}

.item-delete:hover,
.item-delete:focus-visible {
  color: var(--coral-deep);
  background: var(--surface-coral);
}

.empty-state {
  display: grid;
  min-height: 104px;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 15px;
  color: var(--muted);
  text-align: center;
}

.empty-state > span {
  color: var(--coral);
  font-size: 1.1rem;
}

.empty-state strong {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 710;
}

.empty-state p {
  margin: 0;
  font-size: 0.59rem;
  line-height: 1.5;
}

/* simple shopping todo */

.todo-list-section {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.035);
}

.todo-list-heading {
  display: flex;
  min-height: 61px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px 9px 14px;
}

.todo-list-heading > div:first-child {
  min-width: 0;
}

.todo-list-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.todo-list-heading p {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.6rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-list-section .segmented-control {
  min-height: 34px;
}

.todo-list-section .segment-button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.6rem;
}

.todo-list-section .shopping-list {
  margin-top: 0;
  border-top: 1px solid var(--line-soft);
}

.todo-list-section .shopping-item {
  min-height: 57px;
  grid-template-columns: 32px minmax(0, 1fr) auto 28px;
  gap: 8px;
  padding: 9px 12px;
}

.todo-list-section .purchase-toggle {
  width: 28px;
  height: 28px;
}

.todo-list-section .shopping-item-copy strong {
  font-size: 0.8rem;
  font-weight: 760;
}

.todo-list-section .shopping-item-copy span {
  display: none;
}

.todo-list-section .shopping-item.is-completed .shopping-item-copy strong {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: #bdbdbd;
}

.todo-list-section .shopping-item-price {
  max-width: 92px;
  color: var(--ink-soft);
  font-size: 0.69rem;
}

.todo-list-section .shopping-item.is-completed .shopping-item-price {
  color: var(--muted);
}

.todo-list-section .empty-state {
  min-height: 118px;
}

.shopping-statistics-section {
  margin-top: 2px;
}

/* unified selection controls */

.profile-button {
  min-height: var(--selector-height);
  border-radius: var(--selector-radius);
}

.year-switcher,
.segmented-control,
.section-disclosure {
  border: 1px solid var(--line);
  border-radius: var(--selector-radius);
}

.year-switcher {
  min-height: var(--selector-height);
  grid-template-columns: 30px auto 30px;
  padding: 2px;
  background: var(--surface);
}

.year-arrow {
  width: 30px;
  height: 30px;
}

.year-arrow:hover,
.year-arrow:focus-visible {
  color: var(--coral-deep);
  background: var(--surface-coral);
}

.year-select {
  position: relative;
  min-width: 62px;
}

.year-select::after {
  position: absolute;
  top: 50%;
  right: 5px;
  color: var(--muted);
  content: '⌄';
  font-size: 0.74rem;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-56%);
}

.year-select select {
  min-height: 30px;
  padding: 0 15px 0 5px;
  appearance: none;
  color: var(--ink-soft);
}

.segmented-control,
.todo-list-section .segmented-control {
  min-height: var(--selector-height);
  padding: 3px;
  background: var(--surface-subtle);
}

.segment-button,
.todo-list-section .segment-button {
  min-height: 28px;
  padding: 0 10px;
}

.segment-button.is-active {
  color: var(--coral-deep);
  background: var(--surface-coral);
  box-shadow: none;
}

.section-disclosure {
  min-height: var(--selector-height);
  padding: 0 8px 0 10px;
  color: var(--ink-soft);
  background: var(--surface);
}

.section-disclosure:hover,
.section-disclosure:focus-visible,
.collapsible-section.is-open .section-disclosure {
  color: var(--coral-deep);
  border-color: #ffc6d1;
  background: var(--surface-coral);
}

.disclosure-icon {
  width: 17px;
}

/* savings */

.savings-empty {
  display: grid;
  min-height: 145px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 17px;
  border-radius: var(--radius-md);
}

.empty-orb {
  display: grid;
  width: 47px;
  height: 47px;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: var(--coral);
  font-size: 0.9rem;
}

.savings-empty h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.86rem;
  letter-spacing: -0.05em;
}

.savings-empty p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.61rem;
  line-height: 1.45;
}

.savings-empty .primary-button {
  grid-column: 1 / -1;
  width: 100%;
}

.goal-wallet {
  margin-top: 2px;
  padding-bottom: 3px;
}

.wallet-heading {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 1px 7px;
}

.wallet-heading > div {
  min-width: 0;
}

.wallet-kicker {
  margin: 0;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 790;
  letter-spacing: -0.045em;
}

.wallet-heading p:last-child {
  overflow: hidden;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.56rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-edit-button {
  min-height: 30px;
  flex: 0 0 auto;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--ink-soft);
  background: #fff;
  font-size: 0.57rem;
  font-weight: 730;
}

.wallet-edit-button:hover,
.wallet-edit-button:focus-visible {
  outline: none;
  border-color: var(--ink);
  color: var(--ink);
}

.savings-card-track {
  display: block;
  position: relative;
  width: 100%;
  padding: 3px 0 17px;
  isolation: isolate;
}

.goal-wallet-card {
  --wallet-card: #ff385c;
  position: relative;
  display: grid;
  width: 100%;
  height: 74px;
  min-height: 0;
  grid-template-rows: auto 1fr auto auto;
  gap: 11px;
  margin: 0;
  padding: 0 18px;
  overflow: hidden;
  border: 0;
  border-radius: 25px;
  color: #fff;
  text-align: left;
  background: var(--wallet-card);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
  isolation: isolate;
  z-index: 1;
  transition: height 260ms ease, padding 260ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.goal-wallet-card + .goal-wallet-card {
  margin-top: -24px;
}

.goal-wallet-card::before,
.goal-wallet-card::after {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  content: "";
  background: rgba(255, 255, 255, 0.14);
  opacity: 0;
  transition: opacity 180ms ease;
}

.goal-wallet-card::before {
  width: 150px;
  height: 150px;
  top: -66px;
  right: -40px;
}

.goal-wallet-card::after {
  width: 92px;
  height: 92px;
  right: 36px;
  bottom: -60px;
  background: rgba(0, 0, 0, 0.07);
}

.goal-wallet-card.is-active {
  height: 238px;
  padding: 18px;
  z-index: 10;
  box-shadow: 0 15px 28px rgba(0, 0, 0, 0.32);
  animation: wallet-card-reveal 240ms ease both;
}

.goal-wallet-card.is-active::before,
.goal-wallet-card.is-active::after {
  opacity: 1;
}

.goal-wallet-card:hover,
.goal-wallet-card:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.28);
}

.goal-wallet-card:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.wallet-tone-0 {
  --wallet-card: #ff385c;
}

.wallet-tone-1 {
  --wallet-card: #2f6fae;
}

.wallet-tone-2 {
  --wallet-card: #4b426d;
}

.wallet-tone-3 {
  --wallet-card: #287c71;
}

.wallet-card-header,
.wallet-card-body,
.wallet-card-metrics,
.wallet-card-footer {
  position: relative;
  z-index: 1;
}

.wallet-card-header {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.goal-wallet-card:not(.is-active) .wallet-card-header {
  min-height: 74px;
}

.wallet-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wallet-card-kind,
.wallet-card-index {
  font-size: 0.56rem;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.wallet-card-kind {
  opacity: 0.84;
}

.wallet-card-title {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 790;
  letter-spacing: -0.045em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goal-wallet-card.is-active .wallet-card-title {
  font-size: 1.05rem;
  font-weight: 830;
}

.wallet-card-index {
  opacity: 0.72;
}

.wallet-card-body {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wallet-card-body,
.wallet-card-metrics,
.wallet-card-footer {
  visibility: hidden;
  opacity: 0;
  transform: translateY(-7px);
  transition: opacity 150ms ease, transform 180ms ease, visibility 0s linear 180ms;
}

.goal-wallet-card.is-active .wallet-card-body,
.goal-wallet-card.is-active .wallet-card-metrics,
.goal-wallet-card.is-active .wallet-card-footer {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  transition-delay: 90ms;
}

.wallet-card-copy {
  min-width: 0;
}

.wallet-card-copy span,
.wallet-card-copy b {
  display: block;
}

.wallet-card-copy span {
  margin-top: 5px;
  opacity: 0.76;
  font-size: 0.58rem;
}

.wallet-card-copy b {
  overflow: hidden;
  margin-top: 3px;
  font-size: clamp(1.24rem, 6.2vw, 1.62rem);
  font-weight: 840;
  letter-spacing: -0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-water-orb {
  position: relative;
  display: grid;
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.11);
}

.wallet-water {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: max(2px, var(--wallet-fill, 0%));
  background: rgba(255, 255, 255, 0.33);
  transition: height 920ms cubic-bezier(0.2, 0.78, 0.24, 1);
}

.wallet-water-wave {
  position: absolute;
  top: -8px;
  left: -18%;
  display: block;
  width: 136%;
  height: 17px;
  border-radius: 48%;
  background: rgba(255, 255, 255, 0.46);
}

.wallet-water-wave.wave-one {
  animation: wallet-water-wave 3.1s linear infinite;
}

.wallet-water-wave.wave-two {
  top: -6px;
  opacity: 0.55;
  animation: wallet-water-wave-reverse 4.1s linear infinite;
}

.wallet-progress-copy {
  position: relative;
  z-index: 1;
  text-align: center;
}

.wallet-progress-copy strong,
.wallet-progress-copy small {
  display: block;
}

.wallet-progress-copy strong {
  font-size: 0.9rem;
  font-weight: 830;
  letter-spacing: -0.06em;
}

.wallet-progress-copy small {
  margin-top: 1px;
  opacity: 0.78;
  font-size: 0.48rem;
}

.wallet-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 8px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
}

.wallet-card-metrics > div {
  min-width: 0;
  padding: 0 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.wallet-card-metrics > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.wallet-card-metrics > div:last-child {
  padding-right: 0;
}

.wallet-card-metrics span,
.wallet-card-metrics strong {
  display: block;
}

.wallet-card-metrics span {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.48rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-card-metrics strong {
  overflow: hidden;
  margin-top: 3px;
  color: #fff;
  font-size: 0.64rem;
  font-weight: 790;
  letter-spacing: -0.055em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-card-celebration {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
}

.wallet-card-celebration span {
  position: absolute;
  color: #fff;
  font-size: 0.9rem;
  opacity: 0;
  animation: wallet-spark 1050ms ease-out both;
}

.wallet-card-celebration .spark-one {
  top: 44px;
  right: 42px;
}

.wallet-card-celebration .spark-two {
  top: 82px;
  right: 94px;
  animation-delay: 100ms;
}

.wallet-card-celebration .spark-three {
  top: 28px;
  right: 124px;
  animation-delay: 170ms;
}

.goal-wallet-card.is-celebrating .wallet-water-orb {
  animation: wallet-water-bounce 980ms ease-out both;
}

.wallet-progress-line {
  display: block;
  height: 4px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.25);
}

.wallet-progress-line i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #fff;
  transition: width 220ms ease;
}

.wallet-card-remaining {
  max-width: 118px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.54rem;
  font-weight: 690;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.savings-deposit-button {
  width: 100%;
  min-height: 43px;
  margin-top: 10px;
  font-size: 0.72rem;
}

.savings-entry-section {
  margin-top: 10px;
}

.savings-entry {
  display: grid;
  min-height: 61px;
  grid-template-columns: 30px minmax(0, 1fr) auto 27px;
  align-items: center;
  gap: 8px;
  padding: 8px 1px;
  border-top: 1px solid var(--line-soft);
}

.entry-avatar {
  width: 28px;
  height: 28px;
  font-size: 0.53rem;
}

.savings-entry-amount {
  max-width: 84px;
  overflow: hidden;
  color: var(--success);
  font-size: 0.66rem;
  font-weight: 790;
  letter-spacing: -0.05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* clean savings cards */

.goal-wallet {
  margin-top: 0;
  padding-bottom: 0;
}

.wallet-heading {
  min-height: 32px;
  margin: 0 1px 8px;
}

.wallet-heading p:last-child {
  display: none;
}

.wallet-edit-button {
  min-height: 38px;
  padding: 0 11px;
  border-radius: var(--radius-xs);
  font-size: 0.62rem;
}

.savings-card-track {
  display: grid;
  gap: 8px;
  padding: 0;
  isolation: auto;
}

.goal-wallet-card {
  --wallet-accent: var(--coral);
  --wallet-tint: var(--coral-soft);
  position: relative;
  height: 68px;
  gap: 8px;
  padding: 0 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transform: none;
  transition: height 220ms ease, padding 220ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.goal-wallet-card + .goal-wallet-card {
  margin-top: 0;
}

.goal-wallet-card::before,
.goal-wallet-card::after {
  display: none;
}

.goal-wallet-card.is-active {
  height: 228px;
  padding: 15px;
  border-color: #c8e9f4;
  background: #fcfeff;
  box-shadow: 0 5px 14px rgba(34, 34, 34, 0.08);
  animation: none;
  z-index: 1;
}

.goal-wallet-card:hover,
.goal-wallet-card:focus-visible {
  transform: none;
  box-shadow: 0 4px 12px rgba(34, 34, 34, 0.08);
}

.goal-wallet-card.is-wallet-reordering {
  position: relative;
  z-index: 3;
  will-change: transform;
}

.goal-wallet-card.is-active.is-wallet-reordering {
  z-index: 4;
}

.goal-wallet-card:focus-visible {
  outline-color: var(--coral);
}

.wallet-tone-0,
.wallet-tone-1,
.wallet-tone-2,
.wallet-tone-3 {
  --wallet-card: var(--surface);
}

.goal-wallet-card:not(.is-active) .wallet-card-header {
  min-height: 68px;
}

.wallet-card-kind,
.wallet-card-index {
  color: var(--wallet-accent);
  font-size: 0.57rem;
  font-weight: 800;
}

.wallet-card-kind {
  opacity: 1;
}

.wallet-card-title,
.goal-wallet-card.is-active .wallet-card-title {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 790;
}

.goal-wallet-card.is-active .wallet-card-title {
  font-size: 1rem;
  font-weight: 820;
}

.wallet-card-index {
  opacity: 1;
}

.wallet-card-edit {
  display: grid;
  width: 30px;
  height: 30px;
  margin: -6px -6px -6px 0;
  padding: 0 0 4px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--wallet-accent);
  font: inherit;
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  line-height: 1;
  background: transparent;
  cursor: pointer;
}

.wallet-card-edit:hover,
.wallet-card-edit:focus-visible {
  outline: none;
  background: var(--wallet-tint);
}

.wallet-card-edit:focus-visible {
  box-shadow: 0 0 0 2px var(--coral);
}

.wallet-card-copy span {
  margin-top: 0;
  color: var(--muted);
  font-size: 0.57rem;
  opacity: 1;
}

.wallet-card-copy b {
  margin-top: 3px;
  color: var(--ink);
  font-size: clamp(1.25rem, 6vw, 1.55rem);
}

.wallet-water-orb {
  width: 84px;
  height: 84px;
  border: 1.5px solid #9edcec;
  background:
    radial-gradient(circle at 31% 20%, rgba(255, 255, 255, 0.98) 0 5%, transparent 19%),
    radial-gradient(circle at 50% 26%, #ffffff 0 33%, #eaf9fd 69%, #d8f3fb 100%);
  box-shadow: inset 0 0 0 5px rgba(92, 199, 229, 0.08), inset 0 -10px 20px rgba(92, 199, 229, 0.07);
}

.wallet-water {
  height: var(--wallet-fill, 0%);
  overflow: visible;
  opacity: 1;
  background: linear-gradient(180deg, #b9effc 0%, #6ed6ef 55%, #25afd4 100%);
  box-shadow: inset 0 8px 16px rgba(255, 255, 255, 0.34), inset 0 -7px 12px rgba(12, 123, 160, 0.13);
  transition: height 1250ms cubic-bezier(0.14, 0.78, 0.2, 1), opacity 220ms ease;
  transition-timing-function: cubic-bezier(0.14, 0.78, 0.2, 1);
}

.wallet-water-orb.is-empty .wallet-water {
  opacity: 0;
}

.wallet-water::before {
  position: absolute;
  z-index: 2;
  top: -3px;
  left: -8%;
  width: 116%;
  height: 7px;
  content: '';
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(242, 254, 255, 0.94) 0 35%, rgba(163, 232, 247, 0.68) 67%, rgba(73, 194, 223, 0.42) 100%);
  box-shadow: 0 1px 3px rgba(27, 143, 178, 0.12);
}

.wallet-water::after {
  display: none;
  content: none;
}

.wallet-water-bubbles {
  position: absolute;
  z-index: 3;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.wallet-water-bubble {
  position: absolute;
  bottom: -10px;
  left: var(--bubble-x);
  width: var(--bubble-size);
  height: var(--bubble-size);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: radial-gradient(circle at 31% 27%, rgba(255, 255, 255, 0.98) 0 14%, rgba(255, 255, 255, 0.36) 20% 40%, rgba(202, 247, 255, 0.09) 43% 67%, transparent 72%);
  box-shadow: inset -1px -1px 2px rgba(12, 126, 165, 0.2), 0 0 5px rgba(255, 255, 255, 0.48);
  opacity: 0;
  animation: wallet-bubble-rise var(--bubble-duration) ease-in infinite var(--bubble-delay);
}

.wallet-water-bubble.bubble-1 {
  --bubble-x: 13%;
  --bubble-size: 5px;
  --bubble-duration: 3.5s;
  --bubble-delay: -1.1s;
  --bubble-drift: 5px;
  --bubble-burst-delay: 0ms;
}

.wallet-water-bubble.bubble-2 {
  --bubble-x: 31%;
  --bubble-size: 7px;
  --bubble-duration: 4.7s;
  --bubble-delay: -3.2s;
  --bubble-drift: -4px;
  --bubble-burst-delay: 110ms;
}

.wallet-water-bubble.bubble-3 {
  --bubble-x: 53%;
  --bubble-size: 4px;
  --bubble-duration: 3.2s;
  --bubble-delay: -0.3s;
  --bubble-drift: 4px;
  --bubble-burst-delay: 220ms;
}

.wallet-water-bubble.bubble-4 {
  --bubble-x: 70%;
  --bubble-size: 6px;
  --bubble-duration: 4.2s;
  --bubble-delay: -2.4s;
  --bubble-drift: -5px;
  --bubble-burst-delay: 330ms;
}

.wallet-water-bubble.bubble-5 {
  --bubble-x: 84%;
  --bubble-size: 4px;
  --bubble-duration: 3.8s;
  --bubble-delay: -1.8s;
  --bubble-drift: 3px;
  --bubble-burst-delay: 440ms;
}

.wallet-water-bubble.bubble-6 {
  --bubble-x: 24%;
  --bubble-size: 4px;
  --bubble-duration: 4.1s;
  --bubble-delay: -0.8s;
  --bubble-drift: -3px;
  --bubble-burst-delay: 550ms;
}

.wallet-water-bubble.bubble-7 {
  --bubble-x: 47%;
  --bubble-size: 6px;
  --bubble-duration: 3.7s;
  --bubble-delay: -2.6s;
  --bubble-drift: 5px;
  --bubble-burst-delay: 660ms;
}

.wallet-water-bubble.bubble-8 {
  --bubble-x: 68%;
  --bubble-size: 4px;
  --bubble-duration: 4.4s;
  --bubble-delay: -1.5s;
  --bubble-drift: -4px;
  --bubble-burst-delay: 770ms;
}

.goal-wallet-card.is-water-moving .wallet-water {
  animation: none;
}

.goal-wallet-card.is-water-moving .wallet-water-bubble {
  animation: wallet-bubble-rise 760ms cubic-bezier(0.22, 0.72, 0.24, 1) 2 both;
  animation-delay: var(--bubble-burst-delay);
}

.wallet-progress-copy strong {
  color: #117fa6;
}

.wallet-progress-copy small {
  color: var(--muted);
  opacity: 1;
}

.wallet-card-metrics {
  padding-top: 8px;
  border-top-color: var(--line-soft);
}

.wallet-card-metrics > div {
  border-left-color: var(--line-soft);
}

.wallet-card-metrics span {
  color: var(--muted);
}

.wallet-card-metrics strong {
  color: var(--ink);
}

.wallet-card-celebration span {
  color: var(--coral);
}

.wallet-progress-line {
  background: #f0f0f0;
}

.wallet-progress-line i {
  background: #55cce8;
}

.wallet-card-remaining {
  color: var(--muted);
}

/* wallet mode */

body.is-savings-active {
  color: #f7f7f7;
  background: #000;
}

body.is-savings-active .workspace {
  background: #000;
}

body.is-savings-active .header-brand h1,
body.is-savings-active #panel-savings .panel-toolbar h2,
body.is-savings-active #panel-savings .wallet-kicker {
  color: #fff;
}

body.is-savings-active .connection-status,
body.is-savings-active #panel-savings .panel-toolbar p,
body.is-savings-active #panel-savings .wallet-heading p:last-child {
  color: #a7a7a7;
}

body.is-savings-active .profile-button.glass-control,
body.is-savings-active .editor-bubble {
  border-color: #343434;
  color: #f5f5f5;
  background: #171717;
  box-shadow: none;
}

body.is-savings-active #panel-savings .save-button {
  border: 1px solid #3a3a3a;
  color: #fff;
  background: #1a1a1a;
  box-shadow: none;
}

body.is-savings-active #panel-savings .save-button:hover,
body.is-savings-active #panel-savings .save-button:focus-visible {
  border-color: #5d5d5d;
  color: #fff;
  background: #252525;
  box-shadow: none;
}

body.is-savings-active #panel-savings .wallet-edit-button {
  border-color: #3a3a3a;
  color: #f5f5f5;
  background: #171717;
}

body.is-savings-active #panel-savings .wallet-edit-button:hover,
body.is-savings-active #panel-savings .wallet-edit-button:focus-visible {
  border-color: #666;
  color: #fff;
  background: #242424;
}

body.is-savings-active #panel-savings .savings-empty,
body.is-savings-active #panel-savings .collapsible-section {
  border-color: #2d2d2d;
  background: #151515;
  box-shadow: none;
}

body.is-savings-active #panel-savings .savings-empty h3,
body.is-savings-active #panel-savings .collapse-heading h3,
body.is-savings-active #panel-savings .savings-entry-copy strong,
body.is-savings-active #panel-savings .empty-state strong {
  color: #f7f7f7;
}

body.is-savings-active #panel-savings .savings-empty p,
body.is-savings-active #panel-savings .collapse-heading p,
body.is-savings-active #panel-savings .savings-entry-copy span,
body.is-savings-active #panel-savings .empty-state,
body.is-savings-active #panel-savings .empty-state p,
body.is-savings-active #panel-savings .section-count {
  color: #a7a7a7;
}

body.is-savings-active #panel-savings .collapse-content,
body.is-savings-active #panel-savings .savings-entry-list,
body.is-savings-active #panel-savings .savings-entry {
  border-color: #2b2b2b;
}

body.is-savings-active #panel-savings .section-disclosure {
  color: #f1f1f1;
}

body.is-savings-active #panel-savings .section-disclosure:hover,
body.is-savings-active #panel-savings .section-disclosure:focus-visible {
  color: #fff;
  background: #292929;
}

body.is-savings-active #panel-savings .disclosure-icon {
  color: #bdbdbd;
}

body.is-savings-active #panel-savings .savings-deposit-button {
  color: #111;
  background: #f5f5f5;
  box-shadow: none;
}

body.is-savings-active #panel-savings .savings-deposit-button:hover,
body.is-savings-active #panel-savings .savings-deposit-button:focus-visible {
  color: #000;
  background: #fff;
  box-shadow: none;
}

body.is-savings-active .bottom-nav {
  border-color: #292929;
  background: #101010;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.42);
}

body.is-savings-active .tab-button {
  color: #858585;
}

body.is-savings-active .tab-button.is-active {
  color: #fff;
  background: #242424;
}

body.is-savings-active .bottom-sheet {
  border-color: #303030;
  color: #f7f7f7;
  background: #151515;
}

body.is-savings-active .sheet-handle {
  background: #606060;
}

body.is-savings-active .sheet-header h2,
body.is-savings-active .form-field input {
  color: #f7f7f7;
}

body.is-savings-active .close-button,
body.is-savings-active .form-field {
  border-color: #333;
  color: #f7f7f7;
  background: #212121;
}

body.is-savings-active .form-field > span,
body.is-savings-active .form-hint {
  color: #a7a7a7;
}

body.is-savings-active .form-field input::placeholder {
  color: #777;
}

/* navigation */

.bottom-nav {
  position: fixed;
  z-index: 20;
  right: max(10px, env(safe-area-inset-right));
  bottom: var(--bottom-nav-offset);
  left: max(10px, env(safe-area-inset-left));
  display: grid;
  width: min(calc(100% - 20px), 540px);
  min-height: var(--bottom-nav-height);
  grid-template-columns: repeat(2, 1fr);
  margin: 0 auto;
  padding: 4px 5px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.12);
}

.tab-button {
  position: relative;
  display: grid;
  min-height: 56px;
  place-items: center;
  align-content: center;
  gap: 2px;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  font-size: 0.62rem;
  font-weight: 700;
}

.tab-button svg {
  width: 18px;
  height: 18px;
}

.tab-button.is-active {
  color: var(--coral-deep);
  background: var(--surface-coral);
  font-weight: 800;
}

.tab-editor-indicator {
  position: absolute;
  top: 3px;
  right: calc(50% - 34px);
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 1px solid #fff;
  border-radius: 50%;
  color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16);
  font-size: 0.45rem;
  font-weight: 800;
}

.tab-editor-indicator::after {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 5px;
  height: 5px;
  border: 1px solid #fff;
  border-radius: 50%;
  content: "";
  background: #00a699;
}

/* sheets */

.sheet-layer {
  position: fixed;
  z-index: 50;
  inset: 0;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.36);
}

.bottom-sheet {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(100%, 720px);
  max-height: min(88dvh, 700px);
  margin: 0 auto;
  padding: 9px 16px max(20px, env(safe-area-inset-bottom));
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.18);
  animation: sheet-up 200ms ease both;
}

.sheet-handle {
  width: 34px;
  height: 4px;
  margin: 0 auto 10px;
  border-radius: var(--radius-pill);
  background: #c7c7c7;
}

.sheet-header {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sheet-header h2 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 1.05rem;
  letter-spacing: -0.06em;
}

.close-button {
  display: grid;
  width: 33px;
  height: 33px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-soft);
  background: var(--surface-subtle);
  font-size: 1.2rem;
  line-height: 1;
}

.sheet-form {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.form-field {
  display: block;
  min-width: 0;
  padding: 10px 11px;
  border-radius: var(--radius-xs);
  background: #fff;
}

.form-field > span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 710;
}

.form-field > span em {
  color: var(--muted-light);
  font-style: normal;
  font-weight: 560;
}

.form-field > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.form-field input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  color: var(--ink);
  outline: 0;
  background: transparent;
  font-size: 0.84rem;
}

.form-field input::placeholder {
  color: #b0b0b0;
}

.amount-field > div b {
  color: var(--coral);
  font-size: 1.16rem;
  line-height: 1;
}

.amount-field input {
  font-size: 1.14rem;
  font-weight: 780;
  letter-spacing: -0.045em;
}

.completion-fields {
  display: grid;
  gap: 9px;
}

.form-hint {
  margin: 0 3px;
  color: var(--muted);
  font-size: 0.61rem;
  line-height: 1.45;
}

.sheet-submit {
  width: 100%;
  min-height: 43px;
  margin-top: 2px;
  font-size: 0.73rem;
}

.sheet-delete-button {
  min-height: 35px;
  color: var(--coral-deep);
  background: transparent;
  font-size: 0.68rem;
  font-weight: 720;
}

.sheet-delete-button:hover,
.sheet-delete-button:focus-visible {
  outline: none;
  text-decoration: underline;
}

/* confirmation dialog */

.dialog-layer {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
}

.dialog-backdrop {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(34, 34, 34, 0.42);
  backdrop-filter: blur(2px);
}

.confirm-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 16px 44px rgba(34, 34, 34, 0.2);
  animation: dialog-in 180ms ease both;
}

.dialog-symbol {
  display: grid;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 11px;
  color: var(--coral-deep);
  background: var(--surface-coral);
  font-size: 0.9rem;
  font-weight: 850;
}

.confirm-dialog h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 820;
  letter-spacing: -0.055em;
}

.confirm-dialog p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.5;
}

.dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.dialog-cancel,
.dialog-confirm {
  width: 100%;
  min-height: 44px;
  border-radius: var(--radius-xs);
  font-size: 0.69rem;
  font-weight: 780;
}

.dialog-cancel {
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: var(--surface);
}

.dialog-cancel:hover,
.dialog-cancel:focus-visible {
  outline: none;
  border-color: #bdbdbd;
  background: var(--surface-subtle);
}

.dialog-confirm.is-danger {
  background: var(--coral-deep);
}

.toast {
  position: fixed;
  z-index: 70;
  right: 16px;
  bottom: calc(var(--bottom-nav-height) + var(--bottom-nav-offset) + 13px);
  left: 16px;
  width: min(calc(100% - 32px), 430px);
  margin: 0 auto;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: #fff;
  text-align: center;
  background: #222;
  box-shadow: 0 8px 19px rgba(0, 0, 0, 0.17);
  font-size: 0.71rem;
  font-weight: 710;
  animation: toast-in 180ms ease both;
}

.toast.is-error {
  background: var(--coral-deep);
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes wallet-card-reveal {
  from {
    opacity: 0.72;
    transform: translateY(-8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes wallet-water-wave {
  from {
    transform: translateX(-8%) rotate(-2deg);
  }
  50% {
    transform: translateX(5%) rotate(2deg);
  }
  to {
    transform: translateX(-8%) rotate(-2deg);
  }
}

@keyframes wallet-water-wave-reverse {
  from {
    transform: translateX(6%) rotate(2deg);
  }
  50% {
    transform: translateX(-7%) rotate(-2deg);
  }
  to {
    transform: translateX(6%) rotate(2deg);
  }
}

@keyframes wallet-water-slosh {
  0%,
  100% {
    transform: translateX(-10%) rotate(-3deg) scaleY(0.88);
  }
  50% {
    transform: translateX(8%) rotate(3deg) scaleY(1.15);
  }
}

@keyframes wallet-water-slosh-reverse {
  0%,
  100% {
    transform: translateX(9%) rotate(3deg) scaleY(1.12);
  }
  50% {
    transform: translateX(-9%) rotate(-3deg) scaleY(0.86);
  }
}

@keyframes wallet-water-slosh-fast {
  0%,
  100% {
    transform: translateX(-16%) rotate(-6deg) scaleY(0.72);
  }
  50% {
    transform: translateX(15%) rotate(6deg) scaleY(1.32);
  }
}

@keyframes wallet-water-slosh-fast-reverse {
  0%,
  100% {
    transform: translateX(15%) rotate(6deg) scaleY(1.3);
  }
  50% {
    transform: translateX(-16%) rotate(-6deg) scaleY(0.72);
  }
}

@keyframes wallet-water-sheen {
  0%,
  100% {
    transform: translateX(-7%) scaleX(0.96);
  }
  50% {
    transform: translateX(8%) scaleX(1.05);
  }
}

@keyframes wallet-water-sheen-reverse {
  0%,
  100% {
    transform: translateX(7%) scaleX(1.04);
  }
  50% {
    transform: translateX(-8%) scaleX(0.95);
  }
}

@keyframes wallet-water-sheen-fast {
  0%,
  100% {
    transform: translateX(-13%) scaleX(0.9);
  }
  50% {
    transform: translateX(13%) scaleX(1.13);
  }
}

@keyframes wallet-water-sheen-fast-reverse {
  0%,
  100% {
    transform: translateX(13%) scaleX(1.12);
  }
  50% {
    transform: translateX(-13%) scaleX(0.9);
  }
}

@keyframes wallet-water-surface-drift {
  0%,
  100% {
    transform: translateX(-3%) translateY(0) rotate(-0.6deg);
  }
  50% {
    transform: translateX(3%) translateY(-1px) rotate(0.6deg);
  }
}

@keyframes wallet-water-surface-slosh {
  0% {
    transform: translateX(-12%) translateY(3px) rotate(-4deg) scaleY(0.86);
  }
  28% {
    transform: translateX(11%) translateY(-3px) rotate(4deg) scaleY(1.18);
  }
  53% {
    transform: translateX(-7%) translateY(2px) rotate(-2.3deg) scaleY(0.94);
  }
  76% {
    transform: translateX(4%) translateY(-1px) rotate(1.2deg) scaleY(1.04);
  }
  100% {
    transform: translateX(0) translateY(0) rotate(0) scaleY(1);
  }
}

@keyframes wallet-water-level-settle {
  0% {
    transform: translateY(4px) skewX(-3deg);
  }
  36% {
    transform: translateY(-3px) skewX(3deg);
  }
  67% {
    transform: translateY(2px) skewX(-1.8deg);
  }
  100% {
    transform: translateY(0) skewX(0);
  }
}

@keyframes wallet-water-bounce {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.13);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes wallet-bubble-rise {
  0% {
    bottom: -10px;
    opacity: 0;
    transform: translateX(0) scale(0.45);
  }
  14% {
    opacity: 0.88;
    transform: translateX(1px) scale(1);
  }
  74% {
    opacity: 0.52;
  }
  100% {
    bottom: calc(100% + 6px);
    opacity: 0;
    transform: translateX(var(--bubble-drift, 0px)) scale(1.18);
  }
}

@keyframes wallet-spark {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.35) rotate(0deg);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-24px) scale(1.25) rotate(90deg);
  }
}

@keyframes sheet-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 390px) {
  .connection-status #connection-text,
  .profile-chevron {
    display: none;
  }

  .header-actions {
    gap: 4px;
  }

  .profile-button {
    padding-right: 4px;
  }

  .panel-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .editor-bubble {
    display: none;
  }

  .feature-button {
    min-height: 36px;
    padding: 0 9px;
    font-size: 0.61rem;
  }

  .shopping-item-price,
  .savings-entry-amount {
    max-width: 72px;
    font-size: 0.62rem;
  }
}

@media (min-width: 570px) {
  .workspace {
    padding-right: 24px;
    padding-left: 24px;
  }

  .app-header {
    min-height: 46px;
  }

  .shopping-summary {
    min-height: 94px;
  }

  .shopping-month-chart {
    height: 132px;
  }
}

@media (min-width: 800px) {
  :root {
    --bottom-nav-offset: 20px;
  }

  .workspace {
    padding-top: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
