.vupw-planner {
  --vupw-green: #39641E;
  --vupw-lime: #A3DA54;
  --vupw-bg-soft: #f7f9f4;
  --vupw-text-soft: #5f6874;
  --vupw-radius: 12px;
  width: 100%;
  color: inherit;
  font: inherit;
}

.vupw-planner *,
.vupw-planner *::before,
.vupw-planner *::after { box-sizing: border-box; }

.vupw-tabs {
  display: flex;
  gap: .25rem;
  overflow-x: auto;
  padding: .45rem;
  margin-bottom: 1rem;
  background: var(--vupw-lime);
  border: 1px solid var(--vupw-green);
  border-radius: 10px;
  scrollbar-width: thin;
}

.vupw-tab, .vupw-button, .vupw-remove { font: inherit; }

.vupw-tab {
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #1f3414;
  border-radius: 7px;
  padding: .5rem .8rem;
  cursor: pointer;
  line-height: 1.2;
  font-weight: 600;
}

.vupw-tab:hover, .vupw-tab:focus-visible {
  border-color: var(--vupw-green);
  background: rgba(255,255,255,.28);
}

.vupw-tab.is-active {
  background: #fff;
  color: var(--vupw-green);
  border-color: var(--vupw-green);
}

.vupw-tab-overview { margin-left: .2rem; }

.vupw-panel {
  border: 1px solid var(--vupw-green);
  border-radius: var(--vupw-radius);
  overflow: visible;
  background: #fff;
}

.vupw-panel-heading {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--vupw-green);
}

.vupw-panel-heading h3 {
  margin: 0;
  font-size: 1.15rem;
}

.vupw-desktop-table-wrap {
  width: 100%;
  min-height: 340px;
  overflow-x: auto;
  overflow-y: auto;
}

.vupw-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: .78rem;
}

.vupw-table th, .vupw-table td {
  padding: .5rem .4rem;
  border-right: 1px solid var(--vupw-green);
  border-bottom: 1px solid var(--vupw-green);
  vertical-align: middle;
  text-align: right;
}

.vupw-table th:last-child, .vupw-table td:last-child { border-right: 0; }

.vupw-table thead th {
  background: var(--vupw-lime);
  font-weight: 700;
  font-size: .74rem;
  white-space: pre-line;
  line-height: 1.18;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.vupw-table td { white-space: nowrap; }

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

.vupw-table th:nth-child(1), .vupw-table td:nth-child(1) { width: 3.5%; }
.vupw-table th:nth-child(2), .vupw-table td:nth-child(2) { width: 21.5%; }
.vupw-table th:nth-child(3), .vupw-table td:nth-child(3) { width: 6.5%; }
.vupw-table th:nth-child(4), .vupw-table td:nth-child(4) { width: 7.5%; }
.vupw-table th:nth-child(5), .vupw-table td:nth-child(5) { width: 7.5%; }
.vupw-table th:nth-child(6), .vupw-table td:nth-child(6) { width: 7%; }
.vupw-table th:nth-child(7), .vupw-table td:nth-child(7) { width: 8.5%; }
.vupw-table th:nth-child(8), .vupw-table td:nth-child(8) { width: 8%; }
.vupw-table th:nth-child(9), .vupw-table td:nth-child(9) { width: 7.5%; }
.vupw-table th:nth-child(10), .vupw-table td:nth-child(10) { width: 8%; }
.vupw-table th:nth-child(11), .vupw-table td:nth-child(11) { width: 7%; }
.vupw-table th:nth-child(12), .vupw-table td:nth-child(12) { width: 7.5%; }

.vupw-table tbody tr:last-child td { border-bottom: 0; }

.vupw-table tfoot td {
  border-bottom: 0;
  border-top: 2px solid var(--vupw-green);
  background: var(--vupw-bg-soft);
  font-weight: 700;
}

.vupw-overview-table th:first-child, .vupw-overview-table td:first-child { width: 12%; }
.vupw-overview-table th:nth-child(n+2), .vupw-overview-table td:nth-child(n+2) { width: 9.777%; }
.vupw-overview-table thead th { font-size: .74rem; }

.vupw-number { color: var(--vupw-text-soft); }

.vupw-dish-control {
  display: flex;
  align-items: flex-start;
  gap: .25rem;
}

.vupw-combobox {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.vupw-dish-input, .vupw-portions {
  max-width: 100%;
  min-height: 2.1rem;
  border: 1px solid var(--vupw-green);
  border-radius: 6px;
  background: #fff;
  color: inherit;
  padding: .32rem .42rem;
  font: inherit;
}

.vupw-dish-input { width: 100%; min-width: 0; }
.vupw-portions { width: 3.25rem; text-align: right; }

.vupw-dish-input:focus, .vupw-portions:focus {
  outline: 2px solid var(--vupw-lime);
  outline-offset: 1px;
}

.vupw-combobox-panel {
  position: absolute;
  z-index: 9999;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  min-width: 260px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--vupw-green);
  border-radius: 7px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  text-align: left;
}

.vupw-combobox-panel[hidden] { display: none; }

.vupw-combo-category {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: .45rem .6rem;
  background: #eef5e8;
  color: var(--vupw-green);
  border-top: 1px solid #dbe8d2;
  border-bottom: 1px solid #dbe8d2;
  font-weight: 700;
  font-size: .78rem;
}

.vupw-combo-category:first-child { border-top: 0; }

.vupw-combo-option {
  display: block;
  width: 100%;
  padding: .48rem .7rem .48rem .95rem;
  border: 0;
  border-bottom: 1px solid #edf1e9;
  background: #fff;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.vupw-combo-option:hover,
.vupw-combo-option:focus-visible {
  background: #f5faef;
  outline: none;
}

.vupw-combo-empty {
  padding: .7rem;
  color: var(--vupw-text-soft);
  font-style: italic;
}

.vupw-category-badge {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  margin-top: .28rem;
  padding: .18rem .55rem;
  border-radius: 2px;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.vupw-category-badge[hidden] { display: none; }
.vupw-category-badge.is-fruehstueck { background: #F2F282; color: #4D4D4D; }
.vupw-category-badge.is-aufstriche { background: #008000; color: #F2F2F2; }
.vupw-category-badge.is-suppen { background: #FF66CC; color: #F2F2F2; }
.vupw-category-badge.is-hauptgericht { background: #BF4040; color: #F2F2F2; }
.vupw-category-badge.is-grill { background: #CC6600; color: #F2F2F2; }
.vupw-category-badge.is-dessert { background: #0070C0; color: #F2F2F2; }
.vupw-category-badge.is-snacks { background: #FFC000; color: #4D4D4D; }
.vupw-category-badge.is-basic { background: #B2B2B2; color: #F2F2F2; }
.vupw-category-badge.is-default { background: #E5E5E5; color: #4D4D4D; }

.vupw-remove {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  min-width: 1.15rem;
  min-height: 1.15rem;
  padding: 0;
  border: 1px solid var(--vupw-green);
  border-radius: 50%;
  background: #fff;
  color: var(--vupw-green);
  cursor: pointer;
  line-height: .95;
  font-size: .88rem;
  font-weight: 700;
}

.vupw-remove:hover, .vupw-remove:focus-visible { background: var(--vupw-lime); }

.vupw-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1rem;
  border-top: 1px solid var(--vupw-green);
}

.vupw-button {
  appearance: none;
  border: 1px solid var(--vupw-green);
  border-radius: 7px;
  background: var(--vupw-green);
  color: #fff;
  padding: .58rem .85rem;
  cursor: pointer;
  font-weight: 650;
}

.vupw-button:disabled { opacity: .45; cursor: not-allowed; }

.vupw-counter {
  color: var(--vupw-text-soft);
  font-size: .88rem;
}

.vupw-empty-data {
  padding: .9rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--vupw-green);
  background: #f7fce9;
  border-radius: 8px;
}

.vupw-day-name { font-weight: 650; }
.vupw-mobile-list { display: none; }

@media (max-width: 900px) {
  .vupw-desktop-table-wrap {
    display: none;
    min-height: 0;
  }

  .vupw-mobile-list {
    display: grid;
    gap: .75rem;
    padding: .8rem;
  }

  .vupw-panel-heading { padding: .75rem .85rem; }

  .vupw-mobile-card {
    border: 1px solid var(--vupw-green);
    border-radius: 9px;
    padding: .75rem;
    background: #fff;
    overflow: visible;
  }

  .vupw-mobile-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .45rem;
  }

  .vupw-mobile-number {
    font-size: .8rem;
    color: var(--vupw-text-soft);
  }

  .vupw-mobile-card .vupw-combobox,
  .vupw-mobile-card .vupw-dish-input { width: 100%; }

  .vupw-mobile-card .vupw-combobox-panel {
    min-width: 100%;
    max-height: 280px;
  }

  .vupw-mobile-portions-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: .7rem;
    padding-top: .6rem;
    border-top: 1px solid var(--vupw-green);
  }

  .vupw-mobile-highlights, .vupw-mobile-detail-grid, .vupw-mobile-sum-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
    margin-top: .7rem;
  }

  .vupw-mobile-highlights .vupw-mobile-metric:last-child { grid-column: 1 / -1; }

  .vupw-mobile-metric {
    display: flex;
    flex-direction: column;
    gap: .12rem;
    padding: .5rem;
    background: var(--vupw-bg-soft);
    border-radius: 6px;
  }

  .vupw-mobile-metric-label {
    font-size: .73rem;
    color: var(--vupw-text-soft);
    line-height: 1.2;
  }

  .vupw-mobile-metric-value { font-size: .95rem; }

  .vupw-mobile-details { margin-top: .65rem; }

  .vupw-mobile-details summary {
    color: var(--vupw-green);
    font-weight: 650;
    cursor: pointer;
  }

  .vupw-mobile-sum {
    background: var(--vupw-bg-soft);
    border-width: 2px;
  }

  .vupw-mobile-sum h4 { margin: 0; }

  .vupw-actions {
    justify-content: space-between;
    padding: .8rem;
  }

  .vupw-tabs { gap: .2rem; }
  .vupw-tab { padding: .48rem .7rem; }
}

@media (max-width: 520px) {
  .vupw-mobile-highlights, .vupw-mobile-detail-grid, .vupw-mobile-sum-grid {
    grid-template-columns: 1fr 1fr;
  }

  .vupw-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .vupw-button { width: 100%; }
  .vupw-counter { text-align: center; }
}

/* Version 1.3.0 */
.vupw-table thead th:nth-child(n+4) {
  text-align: center;
}

.vupw-overview-table thead th:nth-child(n+2) {
  text-align: center;
}

.vupw-portion-control {
  display: inline-flex;
  align-items: stretch;
  width: 4.65rem;
  max-width: 100%;
  border: 1px solid var(--vupw-green);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.vupw-portion-control .vupw-portions {
  width: 3.25rem;
  min-width: 0;
  min-height: 2.1rem;
  border: 0;
  border-radius: 0;
  text-align: right;
  padding: .32rem .28rem;
}

.vupw-portion-control .vupw-portions:focus {
  outline: 0;
  box-shadow: inset 0 0 0 2px var(--vupw-lime);
}

.vupw-portion-steppers {
  display: flex;
  flex: 0 0 1.4rem;
  flex-direction: column;
  width: 1.4rem;
  border-left: 1px solid var(--vupw-green);
}

.vupw-portion-step {
  flex: 1 1 50%;
  min-height: 1rem;
  padding: 0;
  border: 0;
  background: #fff;
  color: var(--vupw-green);
  font-size: .55rem;
  line-height: 1;
  cursor: pointer;
}

.vupw-portion-step + .vupw-portion-step {
  border-top: 1px solid var(--vupw-green);
}

.vupw-portion-step:hover,
.vupw-portion-step:focus-visible {
  background: var(--vupw-lime);
  outline: none;
}

.vupw-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.vupw-button-secondary {
  background: #fff;
  color: var(--vupw-green);
}

.vupw-button-secondary:hover,
.vupw-button-secondary:focus-visible {
  background: var(--vupw-bg-soft);
}

.vupw-overview-actions {
  justify-content: flex-start;
}

@media (max-width: 520px) {
  .vupw-action-group {
    width: 100%;
    flex-direction: column;
  }

  .vupw-action-group .vupw-button,
  .vupw-overview-actions .vupw-button {
    width: 100%;
  }
}


/* Zahlenwerte: alle numerischen Spalten außer "Nr" rechtsbündig */
.vupw-table tbody td:nth-child(n+3),
.vupw-table tfoot td:not(:first-child),
.vupw-overview-table tbody td:nth-child(n+2),
.vupw-overview-table tfoot td:nth-child(n+2) {
  text-align: right;
}

/* "Nr" bleibt bewusst nicht rechtsbündig */
.vupw-table tbody td:first-child {
  text-align: left;
}

/* Zahlenwerte in der mobilen Darstellung ebenfalls rechtsbündig */
.vupw-mobile-metric-value {
  display: block;
  width: 100%;
  text-align: right;
}
