.pl-app {
  --pl-border: #e2e2e2;
  --pl-bg-alt: #f7f7f5;
  --pl-w: #d97706;
  --pl-b: #2563eb;
  --pl-f: #059669;
  --pl-p: #9333ea;
  --pl-text: #1f2328;
  max-width: 860px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--pl-text);
}

.pl-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--pl-border);
  margin-bottom: 1.25rem;
}

.pl-tab {
  appearance: none;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.pl-tab:hover {
  color: var(--pl-text);
}

.pl-tab.is-active {
  color: var(--pl-text);
  border-bottom-color: var(--pl-b);
}

.pl-panel {
  display: none;
}

.pl-panel.is-active {
  display: block;
  animation: pl-fade 0.15s ease;
}

@keyframes pl-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.pl-section {
  border: 1px solid var(--pl-border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.pl-section__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.9rem;
  background: var(--pl-bg-alt);
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

.pl-section__head::-webkit-details-marker {
  display: none;
}

.pl-section__head::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.15s ease;
  color: #9ca3af;
}

details[open] > .pl-section__head::before {
  transform: rotate(90deg);
}

.pl-section__name::before {
  content: "";
}

.pl-section__sum {
  font-variant-numeric: tabular-nums;
  color: #4b5563;
  font-weight: 500;
}

.pl-items {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.pl-items th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #9ca3af;
  padding: 0.4rem 0.9rem;
  border-bottom: 1px solid var(--pl-border);
}

.pl-items td {
  padding: 0.4rem 0.9rem;
  border-bottom: 1px solid #f0f0ee;
  vertical-align: top;
}

.pl-items tr:last-child td {
  border-bottom: none;
}

.pl-weight {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pl-flags {
  white-space: nowrap;
  width: 1%;
}

.pl-badge {
  display: inline-block;
  min-width: 1.1rem;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 0.05rem 0.25rem;
  margin-right: 0.15rem;
  color: #fff;
}

.pl-badge--w { background: var(--pl-w); }
.pl-badge--b { background: var(--pl-b); }
.pl-badge--f { background: var(--pl-f); }
.pl-badge--p { background: var(--pl-p); }

.pl-summary {
  margin-top: 1rem;
  border: 1px solid var(--pl-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  background: var(--pl-bg-alt);
}

.pl-summary__row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-variant-numeric: tabular-nums;
}

.pl-summary__row--w strong { color: var(--pl-w); }
.pl-summary__row--b strong { color: var(--pl-b); }
.pl-summary__row--f strong { color: var(--pl-f); }

.pl-summary__row--total {
  border-top: 1px solid var(--pl-border);
  margin-top: 0.3rem;
  padding-top: 0.5rem;
  font-weight: 700;
}

.pl-summary__row--pack strong {
  color: #111827;
}

.pl-error {
  color: #b91c1c;
}

@media (max-width: 560px) {
  .pl-items th:nth-child(2),
  .pl-items td:nth-child(2) {
    display: none;
  }
  .pl-tab {
    padding: 0.5rem 0.7rem;
    font-size: 0.92rem;
  }
}
