.v6-savings-panel {
  width: 100%;
  padding: 22px 24px 20px;
  overflow: hidden;
}

.v6-savings-head,
.v6-savings-empty,
.v6-list-title,
.v6-saving-row,
.v6-dialog-head,
.v6-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.v6-savings-head {
  align-items: flex-start;
}

.v6-savings-head h2,
.v6-savings-empty h2,
.v6-dialog-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Songti SC", serif;
  font-weight: 500;
}

.v6-savings-head h2,
.v6-savings-empty h2 {
  font-size: 20px;
}

.v6-savings-head p,
.v6-savings-empty p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.v6-savings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 1fr);
  gap: 14px;
  margin-top: 19px;
}

.v6-savings-progress {
  min-width: 0;
  padding: 18px 19px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--green-soft) 58%, var(--panel));
}

.v6-savings-progress > span,
.v6-balance-cards span {
  color: var(--muted);
  font-size: 10px;
}

.v6-savings-progress > strong {
  display: block;
  margin: 7px 0 14px;
  color: var(--ink);
  font-size: 31px;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
}

.v6-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 72%, var(--panel));
}

.v6-progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 0.45s ease;
}

.v6-savings-progress p {
  margin: 8px 0 0;
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
}

.v6-savings-progress.completed {
  background: color-mix(in srgb, var(--green-soft) 82%, var(--panel));
}

.v6-balance-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.v6-balance-cards > div {
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: color-mix(in srgb, var(--panel) 94%, var(--paper));
}

.v6-balance-cards strong {
  overflow: hidden;
  margin-top: 6px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v6-saving-history {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.v6-list-title {
  padding: 10px 13px;
  background: color-mix(in srgb, var(--green-soft) 44%, var(--panel));
  color: var(--ink);
  font-size: 10px;
}

.v6-list-title span {
  color: var(--green);
  font-weight: 700;
}

.v6-saving-row {
  padding: 10px 13px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.v6-saving-row span strong,
.v6-saving-row span small {
  display: block;
}

.v6-saving-row span strong {
  color: var(--green);
  font-size: 12px;
}

.v6-saving-row span small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.v6-saving-row button {
  flex: none;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 9px;
  cursor: pointer;
}

.v6-rule-note {
  margin: 14px 0 0;
  padding: 11px 13px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--green-soft) 55%, var(--panel));
  color: var(--muted);
  font-size: 10px;
  line-height: 1.75;
}

.v6-rule-note strong {
  color: var(--ink);
}

.v6-savings-empty {
  min-height: 118px;
}

.v6-cash-change-kind {
  display: grid;
  gap: 7px;
  margin-top: 2px;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--green) 28%, var(--line));
  border-radius: 11px;
  background: color-mix(in srgb, var(--green-soft) 62%, var(--panel));
}

.v6-cash-change-kind p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.65;
}

.v6-dialog-backdrop {
  position: fixed;
  z-index: 12000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: auto;
  background: rgb(20 20 18 / 62%);
  backdrop-filter: blur(7px);
}

.v6-dialog {
  width: min(560px, 100%);
  max-height: calc(100svh - 36px);
  padding: 24px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgb(23 21 18 / 30%);
}

.v6-dialog-head {
  align-items: flex-start;
  margin-bottom: 20px;
}

.v6-dialog-head h2 {
  font-size: 23px;
}

.v6-dialog-head > button {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
}

.v6-form {
  display: grid;
  gap: 15px;
}

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

.v6-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.v6-form input,
.v6-form select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: color-mix(in srgb, var(--panel) 94%, #fff);
  color: var(--ink);
  font-size: 13px;
}

.v6-form input:focus,
.v6-form select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 14%, transparent);
}

.v6-form > p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--green-soft);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.v6-form-preview {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 16px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--panel) 92%, var(--paper));
}

.v6-form-preview span {
  color: var(--muted);
  font-size: 10px;
}

.v6-form-preview strong {
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.v6-form-actions {
  justify-content: flex-end;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.v6-toast {
  position: fixed;
  z-index: 13000;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 16px;
  border: 1px solid color-mix(in srgb, var(--green) 55%, var(--line));
  border-radius: 12px;
  background: var(--ink);
  color: var(--panel);
  box-shadow: 0 16px 42px rgb(0 0 0 / 22%);
  font-size: 12px;
  line-height: 1.5;
}

.v6-toast.error {
  border-color: var(--red);
  background: #5d2921;
  color: #fff;
}

html[data-ac-theme="minimal"] .v6-savings-panel,
html[data-ac-theme="minimal"] .v6-dialog {
  border-radius: 11px;
  box-shadow: none;
}

html[data-ac-theme="kawaii"] .v6-savings-panel,
html[data-ac-theme="kawaii"] .v6-dialog {
  border-radius: 24px;
  box-shadow: 0 10px 30px rgb(187 104 147 / 10%);
}

html[data-ac-theme="kawaii"] .v6-progress-track i {
  background: linear-gradient(90deg, #d66f9f, #e9a45e, #a98bd4);
}

html[data-ac-theme="kawaii"] .v6-savings-panel .button,
html[data-ac-theme="kawaii"] .v6-form-actions .button {
  border-radius: 999px;
}

@media (max-width: 1050px) {
  .v6-savings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .sidebar nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .v6-savings-panel,
  .v6-dialog {
    padding: 18px 16px;
  }

  .v6-savings-head,
  .v6-savings-empty {
    align-items: stretch;
    flex-direction: column;
  }

  .v6-savings-head .button,
  .v6-savings-empty .button {
    width: 100%;
  }

  .v6-balance-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .v6-form-grid {
    grid-template-columns: 1fr;
  }

  .v6-dialog-backdrop {
    align-items: end;
    padding: 0;
  }

  .v6-dialog {
    width: 100%;
    max-height: calc(100svh - 16px);
    border-radius: 20px 20px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .v6-toast {
    right: 14px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    left: 14px;
    max-width: none;
    text-align: center;
  }

  html[data-ac-theme="kawaii"] .v6-dialog {
    border-radius: 26px 26px 0 0;
  }
}

@media (max-width: 430px) {
  .v6-savings-progress > strong {
    font-size: 27px;
  }

  .v6-balance-cards strong {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .v6-progress-track i {
    transition: none;
  }
}
