.ent-page {
  padding: 20px 24px;
  width: 100%;
  max-width: 1440px;
  box-sizing: border-box;
}

.ptv-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  align-items: stretch;
  gap: 28px;
  width: 100%;
  height: calc(100dvh - 385px);
  min-height: 360px;
  overflow: hidden;
}

.ptv-list-column,
.ptv-add-column {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.ptv-list-column {
  padding-right: 6px;
}

.ptv-add-column {
  padding-right: 6px;
}

.ent-page-head {
  margin-bottom: 20px;
}

.ent-head {
  font-size: 20px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0 0 16px 0;
}

.ptv-load-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.ptv-add-button {
  flex: 0 0 auto;
  margin-bottom: 1px;
}

.ptv-loading,
.ptv-empty {
  padding: 16px 0;
  color: rgba(0, 0, 0, 0.5);
  font-size: 14px;
}

.ptv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;

  thead {
    position: sticky;
    top: 0;
    z-index: 1;
  }

  th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b6b85;
    background: #f5f5fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  td {
    padding: 10px 12px;
    font-size: 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }

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

.btn-primary.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: #7c3aed;
  border: none;
  border-radius: 20px;
  cursor: pointer;

  &:hover {
    background: #6d28d9;
  }
}

.btn-danger.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  color: #dc2626;
  background: transparent;
  border: 1px solid #f3c8c8;
  border-radius: 16px;
  cursor: pointer;

  &:hover {
    background: #fef2f2;
    border-color: #dc2626;
  }
}

.ptv-new-panel {
  border: 1px solid #e8e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 20px;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  overflow: visible;

  .ent-head {
    font-size: 16px;
    margin-bottom: 12px;
  }
}

@media (max-width: 900px) {
  .ent-page {
    padding: 16px;
  }

  .ptv-content-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .ptv-list-column,
  .ptv-add-column {
    width: 100%;
    overflow: visible;
    padding-right: 0;
  }
}

// Fix the embedded metaform's field grid so labels/checkbox/inputs
// don't overlap (same "section-grid" issue as the Dependency screen)
::ng-deep .ptv-new-panel {
  .section-grid {
    display: block !important;
    grid-template-columns: none !important;
  }

  // Each field wrapper — stack full width, consistent spacing
  .field-wrapper,
  .field-cell {
    display: block !important;
    width: 100% !important;
    margin-bottom: 14px !important;
  }

  // Checkbox field (Scope) — align checkbox + its label on one line
  input[type='checkbox'] {
    width: auto !important;
    margin-right: 8px !important;
    vertical-align: middle !important;
  }

  gb-combobox,
  gb-input {
    display: block;
    width: 216px;
  }

  gb-combobox .formlabel,
  gb-input .formlabel {
    color: #834dd0 !important;
    font-size: 13px !important;
    margin-bottom: 8px !important;
  }

  gb-combobox .mat-mdc-text-field-wrapper,
  gb-input .mat-mdc-text-field-wrapper {
    height: 50px !important;
    border: 1px solid #834dd0 !important;
    border-radius: 6px !important;
    background: #fff !important;
  }

  gb-combobox .mat-mdc-form-field,
  gb-input .mat-mdc-form-field {
    width: 200px !important;
  }

  gb-combobox .mat-mdc-select,
  gb-input input.mat-mdc-input-element {
    font-size: 16px !important;
  }

  // gb-checkbox contains a readonly Material input for form-field behavior.
  // Keep it hidden so the checkbox value (for example, "true") is not shown
  // as a second editable-looking field.
  gb-checkbox input[readonly][tabindex='-1'] {
    display: none !important;
  }

  // Save/Cancel row — same fix as Dependency screen
  .mfe-actions {
    display: flex !important;
    gap: 12px !important;
    margin-top: 8px;

    button {
      padding: 12px 32px !important;
      min-width: 120px !important;
      height: 44px !important;
      font-size: 14px !important;
      border-radius: 8px !important;
      cursor: pointer !important;
    }

    button:first-of-type {
      background: #7c3aed !important;
      color: #fff !important;
      border: none !important;
      font-weight: 600 !important;

      &:hover {
        background: #6d28d9 !important;
      }
    }

    button:last-of-type {
      background: #f3f4f6 !important;
      color: #374151 !important;
      border: 1px solid #d1d5db !important;
      font-weight: 500 !important;

      &:hover {
        background: #e5e7eb !important;
      }
    }
  }
}
