/* ── Color tokens ── */
:root {
  --pi-primary: #0e7490; /* teal — group header, buttons, pagination */
  --pi-primary-dk: #0c6070; /* hover / active */
  --pi-accent: #f59e0b; /* ZIP amber */
  --pi-danger: #ef4444; /* PDF red */
  --pi-purple: #8b5cf6; /* Share purple */
  --pi-wa: #25d366; /* WhatsApp */
  --pi-text: #1e293b; /* dark text */
  --pi-muted: #64748b; /* muted text */
  --pi-border: #e2e8f0; /* borders */
  --pi-bg: #f8fafc; /* light bg */
}

/* ── Wrap ── */
.pi-doc-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding-top: 0 !important;
}

.pi-btn-list,
.pi-updates-title {
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}

/* ── Header ── */
.pi-doc-header {
  /* width: 100%;
  margin-bottom: 20px;
  line-height: 0; */
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-top: 0;
  margin-bottom: 0;
  padding: 0;
}

.pi-doc-header img {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Title ── */
.pi-updates-title {
  text-align: left;
  font-size: 16px;
  color: #1e2a4a;
  font-weight: 700;
  margin-bottom: 6px;
}

/* ── Btn list ── */
.pi-btn-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

/* ── WhatsApp ── */
.pi-wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--pi-wa);
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: opacity 0.15s;
}
.pi-wa-btn:hover {
  opacity: 0.92;
}
.pi-wa-btn-icon {
  display: inline-flex;
  align-items: center;
  font-size: 20px;
  line-height: 1;
}
.pi-wa-btn .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
}

/* ── Group accordion ── */
#pi-documents-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: start;
}

.pi-doc-group {
  margin-bottom: 0;
  border: 1px solid #d9e2ec;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
}

.pi-doc-group-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 13px 14px;
  min-height: 54px;
  border-left: 6px solid #2563eb;
  background: #fff;
  overflow: visible;
  position: relative;
}

.pi-doc-group-name-btn,
.pi-doc-group-arrow-btn {
  display: flex;
  align-items: center;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  color: #1e2a4a;
  transition: all 0.25s ease;
  outline: none;
}

.pi-doc-group-name-btn {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.pi-doc-group-name-btn:hover,
.pi-doc-group-arrow-btn:hover {
  color: #2563eb;
}

.pi-doc-group-name {
  display: block;
  line-height: 1.3;
  pointer-events: none;
}

.pi-group-actions {
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
}

.pi-group-actions .pi-seg-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
}

.pi-doc-group-arrow-btn {
  flex-shrink: 0;
  margin-left: 2px;
  padding: 4px;
}

.pi-doc-group-arrow {
  margin-left: auto;
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg);
  transition: 0.3s ease;
}
.pi-doc-group.is-open .pi-doc-group-arrow {
  transform: rotate(-135deg);
}
.pi-doc-group-header:hover {
  background: #f8fafc;
}

.pi-doc-group.is-open .pi-doc-group-arrow {
  transform: rotate(-135deg);
}

.pi-doc-group-body {
  padding: 12px;
  background: #fff;
  display: none;
}
.pi-doc-group.is-open .pi-doc-group-body {
  display: block;
}

/* ── Segment row ── */
.pi-seg-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-height: auto;
  padding: 12px 14px;
  margin-bottom: 8px;

  background: #fcfcfd;
  border: 1px solid #d7dee8;
  border-radius: 12px;
  transition: all 0.25s ease;
}

.pi-seg-row:first-child {
  border-top: none;
}
.pi-seg-row:last-of-type {
  margin-bottom: 0;
}
.pi-seg-row:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}
.pi-seg-row-hidden[hidden] {
  display: none !important;
}

.pi-seg-label {
  background: transparent;
  border: none;
  padding: 0;
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pi-seg-title {
  font-size: 11px;
  font-weight: 600;
  color: #1e2a4a;
  line-height: 1.3;
}
.pi-seg-count {
  margin-top: 0;
  flex-shrink: 0;
  display: inline-block;
  padding: 4px 10px !important;
  border-radius: 20px;
  background: #e9f8ef;
  color: #16a34a;
  font-size: 9px;
  font-weight: 600;
}

/* ── Action buttons ── */
.pi-seg-actions {
  display: flex;
  gap: 6px;
}

.pi-seg-btn {
  position: relative;
  flex: 1;
  height: 34px;
  z-index: 10;
  border-radius: 10px;
  border: 1px solid;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;
}
.pi-seg-btn span {
  display: none;
}
.pi-seg-btn i,
.pi-seg-btn .dashicons {
  font-size: 16px !important;
  width: 16px !important;
  height: 16px !important;
  line-height: 16px !important;
}
.pi-seg-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}


.pi-btn-zip {
  background: #eef9f1;
  border-color: #b9e7c5;
  color: #16a34a !important;
}
.pi-btn-pdf {
  background: #fff1f1;
  border-color: #ffcaca;
  color: #ef4444 !important;
}
.pi-btn-share {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4f46e5 !important;
}
.pi-seg-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ── Show more ── */
.pi-show-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px auto 4px;
  padding: 10px 20px;
  background: #fff;
  border: 1px solid #f97316;
  color: #f97316;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
  text-decoration: none;
}
.pi-show-more-btn:hover {
  background: #f97316;
  border-color: #f97316;
  color: #fff;
}
.pi-show-more-btn[data-expanded="true"] {
  background: #f97316;
  border-color: #f97316;
  color: #fff;
}
/* ── Empty ── */
.pi-doc-empty {
  padding: 14px 16px;
  background: var(--pi-bg);
  color: var(--pi-muted);
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  font-size: 13px;
}

/* ── Modal ── */
.pi-modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 99999;
  align-items: center;
  justify-content: center;
}
.pi-modal-bg.open {
  display: flex;
}

.pi-modal-box {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}
.pi-modal-box h4 {
  font-size: 17px;
  font-weight: 800;
  color: var(--pi-text);
  margin: 0 0 6px;
}
.pi-modal-box p {
  font-size: 13px;
  color: var(--pi-muted);
  margin-bottom: 16px;
}

.pi-modal-url {
  display: flex;
  border: 1px solid var(--pi-border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 14px;
}
.pi-modal-url input {
  flex: 1;
  padding: 11px 12px;
  border: none;
  font-size: 12px;
  outline: none;
  background: var(--pi-bg);
  color: var(--pi-text);
}
.pi-modal-copy {
  background: var(--pi-primary);
  color: #fff;
  border: none;
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.pi-modal-copy:hover {
  background: var(--pi-primary-dk);
}

.pi-modal-acts {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.pi-wa-share-btn {
  background: var(--pi-wa);
  color: #fff !important;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none !important;
  display: inline-block;
  transition: opacity 0.15s;
}
.pi-wa-share-btn:hover {
  opacity: 0.9;
}
.pi-close-modal {
  background: #f1f5f9;
  color: var(--pi-muted);
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.pi-close-modal:hover {
  background: #e2e8f0;
}

/* ── Toast ── */
.pi-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(70px);
  background: var(--pi-text);
  color: #fff;
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 13px;
  z-index: 999999;
  transition: transform 0.3s;
  pointer-events: none;
}
.pi-toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ── Pagination ── */
.pi-pagination-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}
.pi-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
.pi-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #f97316;
  color: #f97316 !important;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none !important;
  background: #fff;
  transition: all 0.15s;
}
.pi-pagination .page-numbers:hover,
.pi-pagination .page-numbers.current {
  background: #f97316;
  border-color: #f97316;
  color: #fff !important;
}

.pi-pagination .page-numbers.dots {
  border: none;
  background: transparent;
  color: var(--pi-muted) !important;
  min-width: auto;
}
.pi-page-info {
  color: var(--pi-muted);
  font-size: 12px;
}
/* Remove breadcrumb gap above letterhead */
.td-crumb-container {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
}

/* ── Responsive grid columns ── */
@media (max-width: 1100px) {
  #pi-documents-list {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 900px) {
  #pi-documents-list {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  #pi-documents-list {
    grid-template-columns: 1fr;
  }
}

/* ── Responsive ── */
@media (max-width: 767px) {
  .pi-updates-title {
    font-size: 16px;
    margin-bottom: 4px;
  }
  .pi-updates-title::after {
    font-size: 12px;
    margin-top: 2px;
  }
  .pi-wa-btn {
    font-size: 11px;
    padding: 12px 10px;
  }
  .pi-seg-btn i {
    font-size: 15px;
  }
  .pi-doc-group-name-btn {
    font-size: 12px;
  }
  .pi-doc-group-header {
    padding: 10px 12px;
    min-height: 46px;
    gap: 4px;
  }
  .pi-group-actions .pi-seg-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
  }
  .pi-doc-group-body {
    padding: 8px;
  }
  .pi-seg-row + .pi-seg-row {
    margin-top: 8px !important;
  }
  .pi-seg-row {
    gap: 9px;
    padding: 10px 12px;
  }
  .pi-seg-title {
    font-size: 11px;
    line-height: 1.3;
  }
  .pi-seg-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    font-size: 15px;
    border-radius: 10px;
  }
  .pi-seg-actions {
    gap: 6px;
  }
  .pi-pagination .page-numbers {
    min-width: 30px;
    height: 30px;
    font-size: 11px;
  }

  .pi-page-info {
    font-size: 10px;
  }
}