.mod-donations-graph {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  font-family: inherit;
}

.mod-donations-graph__display {
  color: var(--dg-axis, #fff);
  /* Keep vertical breathing room without reducing the available graph width. */
  padding-block: clamp(1rem, 4vw, 2.25rem);
  padding-inline: 0;
  text-align: center;
  overflow: hidden;
}

/* Independent CSS axes and bar let the plot fill its containing column
   without stretching an SVG viewBox. The height setting controls only height. */
.mod-donations-graph__plot {
  box-sizing: border-box;
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  height: var(--dg-graph-height, auto);
  aspect-ratio: var(--dg-graph-aspect-ratio, 3 / 4);
  min-height: 60px;
  overflow: hidden;
  color: var(--dg-axis, #fff);
}

.mod-donations-graph__axis-x,
.mod-donations-graph__axis-y,
.mod-donations-graph__tick {
  position: absolute;
  background-color: var(--dg-axis, #fff);
  pointer-events: none;
}

.mod-donations-graph__axis-x {
  bottom: 0;
  left: 0;
  right: 0;
  height: 10px;
}

.mod-donations-graph__axis-y {
  top: 0;
  bottom: 0;
  right: 0;
  width: 10px;
}

.mod-donations-graph__tick {
  right: 100%;
  width: 20px;
  height: 10px;
  transform: translateY(-50%);
}

.mod-donations-graph__tick--25 { top: 25%; }
.mod-donations-graph__tick--50 { top: 50%; }
.mod-donations-graph__tick--75 { top: 75%; }

.mod-donations-graph__bar-region {
  position: absolute;
  top: 0;
  bottom: 20px;
  left: 20px;
  right: 40px;
  --dg-fill-percent: 0%;
}

.mod-donations-graph__bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--dg-fill-percent);
  background: var(--dg-bar-background);
  transition: height .35s ease;
}

.mod-donations-graph__caption {
  position: absolute;
  left: .5rem;
  bottom: clamp(14px, calc(var(--dg-fill-percent) + 14px), calc(100% - 24px));
  max-width: calc(100% - .5rem);
  color: var(--dg-axis, #fff);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.mod-donations-graph__goal {
  margin: .85rem 0 0;
  font-size: .95rem;
  color: inherit;
}

/* Frontend manager control stays beneath the public graph. */
.mod-donations-graph__manager {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

.mod-donations-graph__manager-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .7rem 1rem;
  font-weight: 600;
}

.mod-donations-graph__manager-label { flex: 0 1 auto; }
.mod-donations-graph__manager-icon { width: 1rem; height: 1rem; fill: currentColor; flex: 0 0 auto; }

/* Native <dialog> is placed in the browser's top layer (not in the graph's layout). */
.mod-donations-graph__manager-dialog {
  box-sizing: border-box;
  inset: 0;
  width: min(960px, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  max-height: min(90vh, 900px);
  max-height: min(90dvh, 900px);
  padding: 0;
  margin: auto;
  border: 1px solid #b6c7d0;
  border-radius: .6rem;
  box-shadow: 0 1.25rem 3.5rem rgba(0, 0, 0, .25);
  background: #fff;
  color: #24313b;
  font-family: inherit;
  font-size: 1rem;
}

.mod-donations-graph__manager-dialog:not([open]) { display: none !important; }
.mod-donations-graph__manager-dialog::backdrop { background: rgba(10, 21, 30, .65); }

.mod-donations-graph__manager-dialog-content {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 900px);
  max-height: min(90dvh, 900px);
  min-height: 0;
  overflow: hidden;
}

.mod-donations-graph__manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid #dde4e8;
  flex: 0 0 auto;
}

.mod-donations-graph__manager-title {
  flex: 1 1 auto;
  margin: 0;
  color: inherit;
  font-size: 1.2rem;
  line-height: 1.35;
  font-weight: 650;
}

.mod-donations-graph__manager-close {
  min-width: 2.2rem;
  min-height: 2.2rem;
  padding: .1rem .4rem;
  font-size: 1.5rem !important;
  line-height: 1;
}

.mod-donations-graph__manager-inner {
  box-sizing: border-box;
  padding: 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
}

.mod-donations-graph__table-wrap { overflow-x: auto; }
.mod-donations-graph__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.mod-donations-graph__message { margin: 0 0 .5rem; font-size: .95rem; }
.mod-donations-graph__message:empty { display: none; }
.mod-donations-graph__message.is-error { color: #b71c1c; }
.mod-donations-graph__message.is-success { color: #22663a; }

.mod-donations-graph__manager-trigger:focus-visible,
.mod-donations-graph__manager-dialog button:focus-visible,
.mod-donations-graph__manager-dialog input:focus-visible {
  outline: 3px solid #0e80a3;
  outline-offset: 2px;
}

.mod-donations-graph__button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #bbcbd2;
  border-radius: .35rem;
  background: #fff;
  color: #1f3746;
  padding: .38rem .75rem;
  font: inherit;
  font-size: .9rem;
  line-height: 1.4;
  cursor: pointer;
}

.mod-donations-graph__button:hover { background: #edf5f7; }
.mod-donations-graph__button:disabled { opacity: .55; cursor: wait; }
.mod-donations-graph__button--primary { background: #206c83; border-color: #206c83; color: #fff; }
.mod-donations-graph__button--primary:hover { background: #18566a; color: #fff; }

.mod-donations-graph__form {
  margin: .75rem 0 1.25rem;
  padding: 1rem;
  border-radius: .4rem;
  background: #f2f7f9;
}

.mod-donations-graph__form[hidden],
.mod-donations-graph__empty[hidden] { display: none; }
.mod-donations-graph__form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.mod-donations-graph__form label { display: flex; flex-direction: column; gap: .25rem; font-size: .92rem; }
.mod-donations-graph__form input {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #b5c6cf;
  border-radius: .32rem;
  padding: .5rem;
  background: #fff;
  color: #23303a;
  font: inherit;
}
.mod-donations-graph__form-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.mod-donations-graph__table { width: 100%; border-collapse: collapse; color: inherit; font-size: .92rem; }
.mod-donations-graph__table th, .mod-donations-graph__table td { border-bottom: 1px solid #e1e9ed; padding: .55rem .4rem; text-align: left; vertical-align: middle; }
.mod-donations-graph__table th { font-weight: 650; background: #f5f8fa; }
.mod-donations-graph__row-actions { white-space: nowrap; text-align: right !important; }
.mod-donations-graph__row-actions .mod-donations-graph__button { margin: .1rem; }
.mod-donations-graph__empty { margin: 1rem 0 0; color: #647782; }

@media (max-width: 500px) {
  .mod-donations-graph__form-grid { grid-template-columns: 1fr; }
  .mod-donations-graph__manager-inner { padding: .65rem; }
  .mod-donations-graph__manager-dialog { width: calc(100vw - 1rem); max-width: calc(100vw - 1rem); }
  .mod-donations-graph__row-actions { white-space: normal; }
  .mod-donations-graph__row-actions .mod-donations-graph__button { margin-bottom: .3rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .mod-donations-graph__bar { transition: height .35s ease; }
}

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