.bpi-admin-wrap .bpi-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin: 18px 0;
}

.bpi-card,
.bpi-widget {
  background: #fff;
  border: 1px solid #dcdcde;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
  padding: 20px;
  margin: 18px 0;
}

.bpi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #eceff3;
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.bpi-header h2 {
  margin: 0 0 6px;
  font-size: 1.55rem;
}

.bpi-header p,
.bpi-footnote,
.bpi-meta,
.bpi-progress-text {
  color: #646970;
  margin: 0;
}

.bpi-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
  font-size: 0.92rem;
}

.bpi-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.bpi-kpi {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  background: #f8fafc;
}

.bpi-kpi span,
.bpi-kpi small {
  display: block;
  color: #646970;
}

.bpi-kpi strong {
  display: block;
  margin: 6px 0;
  font-size: 2rem;
  line-height: 1;
}

.bpi-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0;
}

.bpi-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.bpi-controls select {
  min-width: 220px;
  border-radius: 8px;
}

.bpi-table-wrap {
  overflow-x: auto;
}

.bpi-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.bpi-table th,
.bpi-table td {
  border-bottom: 1px solid #eceff3;
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
}

.bpi-table th:first-child,
.bpi-table td:first-child,
.bpi-table th:nth-child(2),
.bpi-table td:nth-child(2),
.bpi-table th.bpi-date-col,
.bpi-table td.bpi-date-col {
  text-align: left;
}

.bpi-table thead th {
  background: #f6f7f7;
  font-weight: 700;
}

.bpi-progress {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: #edf0f2;
  overflow: hidden;
  margin: 14px 0 8px;
}

.bpi-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2271b1, #72aee6);
  transition: width 0.35s ease;
}

.bpi-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 700px) {
  .bpi-header {
    display: block;
  }
  .bpi-meta {
    text-align: left;
    margin-top: 10px;
  }
  .bpi-card,
  .bpi-widget {
    padding: 14px;
  }
}

.bpi-calculator {
  border: 1px solid #dbe3ea;
  border-radius: 14px;
  background: #fbfdff;
  padding: 18px;
  margin: 18px 0;
}

.bpi-calculator-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.bpi-calculator-head h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.bpi-calculator-head p {
  color: #646970;
  margin: 0;
}

.bpi-secondary-button,
.bpi-icon-button {
  border: 1px solid #2271b1;
  background: #fff;
  color: #135e96;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.bpi-secondary-button {
  padding: 8px 12px;
  white-space: nowrap;
}

.bpi-secondary-button:hover,
.bpi-icon-button:hover {
  background: #f0f6fc;
}

.bpi-sheet-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.bpi-sheet {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.bpi-sheet th,
.bpi-sheet td {
  border-bottom: 1px solid #eceff3;
  padding: 9px 10px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.bpi-sheet th:first-child,
.bpi-sheet td:first-child,
.bpi-sheet th:nth-child(2),
.bpi-sheet td:nth-child(2),
.bpi-sheet th:nth-child(4),
.bpi-sheet td:nth-child(4),
.bpi-sheet th:nth-child(5),
.bpi-sheet td:nth-child(5) {
  text-align: left;
}

.bpi-sheet thead th,
.bpi-sheet tfoot th {
  background: #f6f7f7;
  font-weight: 700;
}

.bpi-sheet tfoot th,
.bpi-sheet tfoot td {
  border-bottom: 0;
}

.bpi-sheet input,
.bpi-sheet select {
  width: 100%;
  min-width: 120px;
  border: 1px solid #c3c4c7;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
}

.bpi-sheet [data-bpi-name] {
  min-width: 150px;
}

.bpi-sheet [data-bpi-amount] {
  min-width: 130px;
  text-align: right;
}

.bpi-sheet [data-bpi-row-category] {
  min-width: 220px;
}

.bpi-icon-button {
  width: 30px;
  height: 30px;
  font-size: 20px;
  line-height: 1;
}

.bpi-calculator-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.bpi-calculator-summary div {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
}

.bpi-calculator-summary span {
  color: #646970;
  display: block;
  margin-bottom: 4px;
}

.bpi-calculator-summary strong {
  display: block;
  font-size: 1.25rem;
}

@media (max-width: 700px) {
  .bpi-calculator-head {
    display: block;
  }

  .bpi-secondary-button {
    margin-top: 12px;
    width: 100%;
  }
}

.bpi-calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.bpi-calc-grid label {
  display: block;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
}

.bpi-calc-grid span {
  display: block;
  color: #646970;
  font-weight: 600;
  margin-bottom: 6px;
}

.bpi-calc-grid input,
.bpi-calc-grid select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #c3c4c7;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
}

.bpi-calc-grid [data-bpi-amount] {
  text-align: right;
}

.bpi-simple-result strong[data-bpi-result] {
  font-size: 1.5rem;
}

.bpi-formula-line {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  margin: 14px 0 0;
}

.bpi-rechenweg,
.bpi-conversion-sheet {
  border: 1px solid #dbe3ea;
  border-radius: 14px;
  background: #fbfdff;
  padding: 16px;
  margin: 18px 0;
}

.bpi-rechenweg p {
  margin: 0 0 8px;
}

.bpi-rechenweg p:last-child {
  margin-bottom: 0;
}

.bpi-conversion-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.bpi-conversion-head h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.bpi-conversion-head p {
  color: #646970;
  margin: 0;
}

.bpi-destatis-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 40px;
  padding: 10px 18px;
  border-radius: 999px;
  background: #2271b1;
  color: #fff !important;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(34, 113, 177, 0.18);
}

.bpi-destatis-cta-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.05;
}

.bpi-destatis-cta-title {
  color: #fff !important;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.bpi-destatis-cta-subtitle {
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.bpi-destatis-cta-arrow {
  color: #fff !important;
  font-size: 1.3em;
  line-height: 1;
  margin-left: 2px;
}

.bpi-destatis-cta:hover,
.bpi-destatis-cta:focus {
  background: #135e96;
  color: #fff;
  text-decoration: none;
}

.bpi-basis-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0 14px;
}

.bpi-basis-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.bpi-basis-row select {
  min-width: 180px;
  border-radius: 8px;
}

.bpi-conversion-table th span {
  color: #646970;
  font-size: 0.86em;
  font-weight: 500;
}

.bpi-stichtag-controls {
  align-items: flex-end;
}

.bpi-stichtag-controls input[type="date"],
.bpi-stichtag-controls select {
  min-height: 40px;
  border: 1px solid #c3c4c7;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
}

.bpi-reset-date {
  min-height: 40px;
  height: 40px;
  margin-top: 0;
  align-self: flex-end;
}

.bpi-stichtag-status {
  margin: 8px 0 12px;
  color: #1d2327;
  background: #f6f7f7;
  border-left: 4px solid #2271b1;
  padding: 10px 12px;
  border-radius: 8px;
}


.bpi-table tr.bpi-year-separator td {
  border-top: 2px solid #9ca3af;
}

.bpi-table tr.bpi-selected-row td {
  background: #fff3cd;
  font-weight: 700;
}

.bpi-table tr.bpi-selected-row td:first-child {
  border-left: 4px solid #d63638;
}

.bpi-rechenweg-inner {
  background: #fff;
}

.bpi-conversion-table th {
  vertical-align: bottom;
}

@media (max-width: 700px) {
  .bpi-stichtag-controls label,
  .bpi-stichtag-controls button {
    width: 100%;
  }
}

.bpi-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.bpi-chart-card {
  background: #fff;
  border: 1px solid #dbe3ea;
  border-radius: 14px;
  padding: 14px;
}

.bpi-chart-card h4 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.bpi-chart-card canvas {
  display: block;
  width: 100%;
  height: 260px;
}

.bpi-chart-card.is-empty::after {
  content: 'Keine Daten verfügbar.';
  display: block;
  color: #646970;
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  .bpi-charts {
    grid-template-columns: 1fr;
  }
}

.bpi-control-action {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-self: flex-end;
  padding-top: 38px;
}

.bpi-control-spacer {
  display: none;
}

.bpi-stichtag-controls .bpi-control-action .bpi-reset-date {
  align-self: stretch;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  height: 40px;
  margin: 0;
  padding: 7px 24px;
  line-height: 1.2;
}

@media (max-width: 700px) {
  .bpi-control-action,
  .bpi-control-action .bpi-reset-date {
    width: 100%;
  }

  .bpi-control-spacer {
    display: none;
  }
}

/* Stabile Filterleiste: Labels oben, alle Felder und der Button exakt in einer unteren Grid-Zeile. */
.bpi-conversion-sheet .bpi-stichtag-controls {
  display: grid !important;
  grid-template-columns: minmax(220px, 0.8fr) minmax(260px, 0.95fr) minmax(260px, 0.95fr) max-content;
  align-items: end !important;
  justify-content: start;
  column-gap: 20px;
  row-gap: 12px;
}

.bpi-conversion-sheet .bpi-stichtag-controls .bpi-control-field {
  display: grid !important;
  grid-template-rows: auto 64px;
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.bpi-conversion-sheet .bpi-stichtag-controls .bpi-control-field > label,
.bpi-conversion-sheet .bpi-stichtag-controls .bpi-control-label-placeholder {
  display: block !important;
  min-height: 1.25em;
  margin: 0 !important;
  padding: 0 !important;
  font-weight: 700;
  line-height: 1.25;
}

.bpi-conversion-sheet .bpi-stichtag-controls input[type="date"],
.bpi-conversion-sheet .bpi-stichtag-controls select,
.bpi-conversion-sheet .bpi-stichtag-controls .bpi-reset-date {
  box-sizing: border-box !important;
  width: 100% !important;
  height: 64px !important;
  min-height: 64px !important;
  margin: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: 1.2 !important;
}

.bpi-conversion-sheet .bpi-stichtag-controls .bpi-control-action {
  align-self: end !important;
  justify-self: start;
  padding: 0 !important;
  margin: 0 !important;
  min-width: 220px;
  width: 220px;
}

.bpi-conversion-sheet .bpi-stichtag-controls .bpi-control-action .bpi-reset-date {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .bpi-conversion-sheet .bpi-stichtag-controls {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .bpi-conversion-sheet .bpi-stichtag-controls .bpi-control-action {
    justify-self: stretch;
    min-width: 0;
  }
}

@media (max-width: 700px) {
  .bpi-conversion-sheet .bpi-stichtag-controls {
    grid-template-columns: 1fr;
  }

  .bpi-conversion-sheet .bpi-stichtag-controls .bpi-control-action,
  .bpi-conversion-sheet .bpi-stichtag-controls .bpi-control-action .bpi-reset-date {
    width: 100% !important;
  }
}


/* Eigener Kalender für den Wertermittlungsstichtag: kein Browser-Standard-Datepicker. */
.bpi-date-input-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
}

.bpi-date-input-wrap input[data-bpi-valuation-date] {
  box-sizing: border-box;
  width: 100%;
  padding-right: 54px !important;
}

.bpi-date-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1d2327;
  font-size: 1.05rem;
  cursor: pointer;
}

.bpi-date-toggle:hover,
.bpi-date-toggle:focus {
  background: #f0f6fc;
  outline: none;
}

.bpi-conversion-sheet .bpi-stichtag-controls .bpi-date-input-wrap,
.bpi-conversion-sheet .bpi-stichtag-controls input[data-bpi-valuation-date] {
  box-sizing: border-box !important;
  width: 100% !important;
  height: 64px !important;
  min-height: 64px !important;
  margin: 0 !important;
  line-height: 1.2 !important;
}

.bpi-datepicker {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 9999;
  width: 380px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid #cfd8e3;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.bpi-datepicker[hidden] {
  display: none !important;
}

.bpi-datepicker-header {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.bpi-datepicker-title {
  color: #1d2327;
  font-weight: 800;
  text-align: center;
}

.bpi-datepicker-selects {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 6px;
  align-items: center;
}

.bpi-datepicker-selects select {
  width: 100%;
  height: 36px;
  min-height: 36px;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  background: #fff;
  color: #1d2327;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 4px 8px;
}

.bpi-datepicker-selects select:hover,
.bpi-datepicker-selects select:focus {
  border-color: #2271b1;
  outline: none;
}

.bpi-datepicker-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  background: #f8fafc;
  color: #1f2937;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.bpi-datepicker-nav:hover,
.bpi-datepicker-nav:focus {
  background: #eef6ff;
  border-color: #2271b1;
}

.bpi-datepicker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.bpi-datepicker-weekday {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  padding: 4px 0;
}

.bpi-datepicker-empty {
  min-height: 36px;
}

.bpi-datepicker-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #1d2327;
  font-weight: 600;
  cursor: pointer;
}

.bpi-datepicker-day:hover,
.bpi-datepicker-day:focus {
  background: #eef6ff;
  border-color: #b6d6f2;
  outline: none;
}

.bpi-datepicker-day.is-today {
  border-color: #2271b1;
}

.bpi-datepicker-day.is-selected {
  background: #2271b1;
  border-color: #2271b1;
  color: #fff;
}

.bpi-datepicker-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

.bpi-datepicker-today,
.bpi-datepicker-clear {
  border: 1px solid #dbe3ea;
  border-radius: 999px;
  background: #fff;
  color: #145a91;
  cursor: pointer;
  font-weight: 700;
  padding: 6px 12px;
}

.bpi-datepicker-today:hover,
.bpi-datepicker-clear:hover,
.bpi-datepicker-today:focus,
.bpi-datepicker-clear:focus {
  background: #eef6ff;
  border-color: #2271b1;
}

/* Standard-Datepicker über WordPress/jQuery UI */
.bpi-jqui-datepicker.ui-datepicker {
  z-index: 999999 !important;
  width: 320px;
  padding: 14px;
  border: 1px solid #d7dee8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
  font-family: inherit;
}

.bpi-jqui-datepicker .ui-datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.bpi-jqui-datepicker .ui-datepicker-prev,
.bpi-jqui-datepicker .ui-datepicker-next {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #d7dee8;
  border-radius: 10px;
  color: #155e9f;
  cursor: pointer;
  text-decoration: none;
}

.bpi-jqui-datepicker .ui-datepicker-prev span,
.bpi-jqui-datepicker .ui-datepicker-next span {
  display: none;
}

.bpi-jqui-datepicker .ui-datepicker-prev::before {
  content: '‹';
  font-size: 26px;
  line-height: 1;
}

.bpi-jqui-datepicker .ui-datepicker-next::before {
  content: '›';
  font-size: 26px;
  line-height: 1;
}

.bpi-jqui-datepicker .ui-datepicker-title {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: center;
  margin: 0;
}

.bpi-jqui-datepicker select.ui-datepicker-month,
.bpi-jqui-datepicker select.ui-datepicker-year {
  width: auto;
  min-width: 110px;
  height: 36px;
  min-height: 36px;
  padding: 4px 28px 4px 10px;
  border: 1px solid #d7dee8;
  border-radius: 10px;
  background-color: #fff;
  font-size: 15px;
  font-weight: 700;
  color: #1f2937;
}

.bpi-jqui-datepicker table.ui-datepicker-calendar {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 0;
}

.bpi-jqui-datepicker th {
  padding: 6px 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.bpi-jqui-datepicker td {
  padding: 3px;
  text-align: center;
}

.bpi-jqui-datepicker td a,
.bpi-jqui-datepicker td span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #1f2937;
  font-weight: 700;
  text-decoration: none;
}

.bpi-jqui-datepicker td a:hover,
.bpi-jqui-datepicker td a:focus {
  background: #eaf4ff;
  color: #155e9f;
}

.bpi-jqui-datepicker .ui-datepicker-current-day a,
.bpi-jqui-datepicker .ui-datepicker-today a {
  background: #2271b1;
  color: #fff !important;
}

.bpi-jqui-datepicker .ui-datepicker-buttonpane {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.bpi-jqui-datepicker .ui-datepicker-buttonpane button {
  border: 1px solid #d7dee8;
  border-radius: 999px;
  background: #fff;
  color: #155e9f;
  padding: 7px 12px;
  font-weight: 800;
  cursor: pointer;
}
